static int get_metadata_size(const uint8_t *buf, int buf_size)

{

    int metadata_last, metadata_size;

    const uint8_t *buf_end = buf + buf_size;



    buf += 4;

    do {

        ff_flac_parse_block_header(buf, &metadata_last, NULL, &metadata_size);

        buf += 4;

        if (buf + metadata_size > buf_end) {

            /* need more data in order to read the complete header */

            return 0;

        }

        buf += metadata_size;

    } while (!metadata_last);



    return buf_size - (buf_end - buf);

}

static int get_metadata_size(const uint8_t *buf, int buf_size)

{

    int metadata_last, metadata_size;

    const uint8_t *buf_end = buf + buf_size;



    buf += 4;

    do {

        ff_flac_parse_block_header(buf, &metadata_last, NULL, &metadata_size);

        buf += 4;

        if (buf + metadata_size > buf_end) {

            

            return 0;

        }

        buf += metadata_size;

    } while (!metadata_last);



    return buf_size - (buf_end - buf);

}

        if (buf + metadata_size > buf_end) {
static int FUNC_0(const uint8_t *VAR_0, int VAR_1)

{

    int VAR_2, VAR_3;

    const uint8_t *VAR_4 = VAR_0 + VAR_1;



    VAR_0 += 4;

    do {

        ff_flac_parse_block_header(VAR_0, &VAR_2, NULL, &VAR_3);

        VAR_0 += 4;

        if (VAR_0 + VAR_3 > VAR_4) {

            

            return 0;

        }

        VAR_0 += VAR_3;

    } while (!VAR_2);



    return VAR_1 - (VAR_4 - VAR_0);

}

static int FUNC_0(const uint8_t *VAR_0, int VAR_1)
{ int VAR_2, VAR_3; const uint8_t *VAR_4 = VAR_0 + VAR_1; VAR_0 += 4; do { ff_flac_parse_block_header(VAR_0, &VAR_2, NULL, &VAR_3); VAR_0 += 4; if (VAR_0 + VAR_3 > VAR_4) { return 0; } VAR_0 += VAR_3; } while (!VAR_2); return VAR_1 - (VAR_4 - VAR_0); }