static int vivo_probe(AVProbeData *p)

{

    const unsigned char *buf = p->buf;

    unsigned c, length = 0;



    // stream must start with packet of type 0 and sequence number 0

    if (*buf++ != 0)

        return 0;



    // read at most 2 bytes of coded length

    c = *buf++;

    length = c & 0x7F;

    if (c & 0x80) {

        c = *buf++;

        length = (length << 7) | (c & 0x7F);

    }

    if (c & 0x80 || length > 1024 || length < 21)

        return 0;



    if (memcmp(buf, "\r\nVersion:Vivo/", 15))

        return 0;

    buf += 15;



    if (*buf < '0' && *buf > '2')

        return 0;



    return AVPROBE_SCORE_MAX;

}

static int vivo_probe(AVProbeData *p)

{

    const unsigned char *buf = p->buf;

    unsigned c, length = 0;



    

    if (*buf++ != 0)

        return 0;



    

    c = *buf++;

    length = c & 0x7F;

    if (c & 0x80) {

        c = *buf++;

        length = (length << 7) | (c & 0x7F);

    }

    if (c & 0x80 || length > 1024 || length < 21)

        return 0;



    if (memcmp(buf, "\r\nVersion:Vivo/", 15))

        return 0;

    buf += 15;



    if (*buf < '0' && *buf > '2')

        return 0;



    return AVPROBE_SCORE_MAX;

}

static int FUNC_0(AVProbeData *VAR_0)

{

    const unsigned char *VAR_1 = VAR_0->VAR_1;

    unsigned VAR_2, VAR_3 = 0;



    

    if (*VAR_1++ != 0)

        return 0;



    

    VAR_2 = *VAR_1++;

    VAR_3 = VAR_2 & 0x7F;

    if (VAR_2 & 0x80) {

        VAR_2 = *VAR_1++;

        VAR_3 = (VAR_3 << 7) | (VAR_2 & 0x7F);

    }

    if (VAR_2 & 0x80 || VAR_3 > 1024 || VAR_3 < 21)

        return 0;



    if (memcmp(VAR_1, "\r\nVersion:Vivo/", 15))

        return 0;

    VAR_1 += 15;



    if (*VAR_1 < '0' && *VAR_1 > '2')

        return 0;



    return AVPROBE_SCORE_MAX;

}

static int FUNC_0(AVProbeData *VAR_0)
{ const unsigned char *VAR_1 = VAR_0->VAR_1; unsigned VAR_2, VAR_3 = 0; if (*VAR_1++ != 0)
return 0; VAR_2 = *VAR_1++; VAR_3 = VAR_2 & 0x7F; if (VAR_2 & 0x80) { VAR_2 = *VAR_1++; VAR_3 = (VAR_3 << 7) | (VAR_2 & 0x7F); } if (VAR_2 & 0x80 || VAR_3 > 1024 || VAR_3 < 21)
return 0; if (memcmp(VAR_1, "\r\nVersion:Vivo/", 15))
return 0; VAR_1 += 15; if (*VAR_1 < '0' && *VAR_1 > '2')
return 0; return AVPROBE_SCORE_MAX; }