static int find_headers_search_validate(FLACParseContext *fpc, int offset)
{
    FLACFrameInfo fi;
    uint8_t *header_buf;
    int size = 0;
    header_buf = flac_fifo_read_wrap(fpc, offset,
                                     MAX_FRAME_HEADER_SIZE,
                                     &fpc->wrap_buf,
                                     &fpc->wrap_buf_allocated_size);
    if (frame_header_is_valid(fpc->avctx, header_buf, &fi)) {
        FLACHeaderMarker **end_handle = &fpc->headers;
        int i;
        size = 0;
        while (*end_handle) {
            end_handle = &(*end_handle)->next;
            size++;
        *end_handle = av_mallocz(sizeof(**end_handle));
        if (!*end_handle) {
            av_log(fpc->avctx, AV_LOG_ERROR,
                   "couldn't allocate FLACHeaderMarker\n");
        (*end_handle)->fi           = fi;
        (*end_handle)->offset       = offset;
        (*end_handle)->link_penalty = av_malloc(sizeof(int) *
                                            FLAC_MAX_SEQUENTIAL_HEADERS);
        for (i = 0; i < FLAC_MAX_SEQUENTIAL_HEADERS; i++)
            (*end_handle)->link_penalty[i] = FLAC_HEADER_NOT_PENALIZED_YET;
        fpc->nb_headers_found++;
        size++;
    return size;
static int find_headers_search_validate(FLACParseContext *fpc, int offset)
{
    FLACFrameInfo fi;
    uint8_t *header_buf;
    int size = 0;
    header_buf = flac_fifo_read_wrap(fpc, offset,
                                     MAX_FRAME_HEADER_SIZE,
                                     &fpc->wrap_buf,
                                     &fpc->wrap_buf_allocated_size);
    if (frame_header_is_valid(fpc->avctx, header_buf, &fi)) {
        FLACHeaderMarker **end_handle = &fpc->headers;
        int i;
        size = 0;
        while (*end_handle) {
            end_handle = &(*end_handle)->next;
            size++;
        *end_handle = av_mallocz(sizeof(**end_handle));
        if (!*end_handle) {
            av_log(fpc->avctx, AV_LOG_ERROR,
                   "couldn't allocate FLACHeaderMarker\n");
        (*end_handle)->fi           = fi;
        (*end_handle)->offset       = offset;
        (*end_handle)->link_penalty = av_malloc(sizeof(int) *
                                            FLAC_MAX_SEQUENTIAL_HEADERS);
        for (i = 0; i < FLAC_MAX_SEQUENTIAL_HEADERS; i++)
            (*end_handle)->link_penalty[i] = FLAC_HEADER_NOT_PENALIZED_YET;
        fpc->nb_headers_found++;
        size++;
    return size;
static int FUNC_0(FLACParseContext *VAR_0, int VAR_1)
{
    FLACFrameInfo fi;
    uint8_t *header_buf;
    int VAR_2 = 0;
    header_buf = flac_fifo_read_wrap(VAR_0, VAR_1,
                                     MAX_FRAME_HEADER_SIZE,
                                     &VAR_0->wrap_buf,
                                     &VAR_0->wrap_buf_allocated_size);
    if (frame_header_is_valid(VAR_0->avctx, header_buf, &fi)) {
        FLACHeaderMarker **end_handle = &VAR_0->headers;
        int VAR_3;
        VAR_2 = 0;
        while (*end_handle) {
            end_handle = &(*end_handle)->next;
            VAR_2++;
        *end_handle = av_mallocz(sizeof(**end_handle));
        if (!*end_handle) {
            av_log(VAR_0->avctx, AV_LOG_ERROR,
                   "couldn't allocate FLACHeaderMarker\n");
        (*end_handle)->fi           = fi;
        (*end_handle)->VAR_1       = VAR_1;
        (*end_handle)->link_penalty = av_malloc(sizeof(int) *
                                            FLAC_MAX_SEQUENTIAL_HEADERS);
        for (VAR_3 = 0; VAR_3 < FLAC_MAX_SEQUENTIAL_HEADERS; VAR_3++)
            (*end_handle)->link_penalty[VAR_3] = FLAC_HEADER_NOT_PENALIZED_YET;
        VAR_0->nb_headers_found++;
        VAR_2++;
    return VAR_2;
static int FUNC_0(FLACParseContext *VAR_0, int VAR_1)
{ FLACFrameInfo fi; uint8_t *header_buf; int VAR_2 = 0; header_buf = flac_fifo_read_wrap(VAR_0, VAR_1,
MAX_FRAME_HEADER_SIZE,
&VAR_0->wrap_buf,
&VAR_0->wrap_buf_allocated_size); if (frame_header_is_valid(VAR_0->avctx, header_buf, &fi)) { FLACHeaderMarker **end_handle = &VAR_0->headers; int VAR_3; VAR_2 = 0; while (*end_handle) { end_handle = &(*end_handle)->next; VAR_2++; *end_handle = av_mallocz(sizeof(**end_handle)); if (!*end_handle) { av_log(VAR_0->avctx, AV_LOG_ERROR,
"couldn't allocate FLACHeaderMarker\n"); (*end_handle)->fi           = fi; (*end_handle)->VAR_1       = VAR_1; (*end_handle)->link_penalty = av_malloc(sizeof(int) *
FLAC_MAX_SEQUENTIAL_HEADERS); for (VAR_3 = 0; VAR_3 < FLAC_MAX_SEQUENTIAL_HEADERS; VAR_3++) (*end_handle)->link_penalty[VAR_3] = FLAC_HEADER_NOT_PENALIZED_YET; VAR_0->nb_headers_found++; VAR_2++; return VAR_2;