int ff_insert_pad(unsigned idx, unsigned *count, size_t padidx_off,

                   AVFilterPad **pads, AVFilterLink ***links,

                   AVFilterPad *newpad)

{

    AVFilterLink **newlinks;

    AVFilterPad *newpads;

    unsigned i;



    idx = FFMIN(idx, *count);



    newpads  = av_realloc_array(*pads,  *count + 1, sizeof(AVFilterPad));

    newlinks = av_realloc_array(*links, *count + 1, sizeof(AVFilterLink*));

    if (newpads)

        *pads  = newpads;

    if (newlinks)

        *links = newlinks;

    if (!newpads || !newlinks)

        return AVERROR(ENOMEM);



    memmove(*pads  + idx + 1, *pads  + idx, sizeof(AVFilterPad)   * (*count - idx));

    memmove(*links + idx + 1, *links + idx, sizeof(AVFilterLink*) * (*count - idx));

    memcpy(*pads + idx, newpad, sizeof(AVFilterPad));

    (*links)[idx] = NULL;



    (*count)++;

    for (i = idx + 1; i < *count; i++)

        if (*links[i])

            (*(unsigned *)((uint8_t *) *links[i] + padidx_off))++;



    return 0;

}

int ff_insert_pad(unsigned idx, unsigned *count, size_t padidx_off,

                   AVFilterPad **pads, AVFilterLink ***links,

                   AVFilterPad *newpad)

{

    AVFilterLink **newlinks;

    AVFilterPad *newpads;

    unsigned i;



    idx = FFMIN(idx, *count);



    newpads  = av_realloc_array(*pads,  *count + 1, sizeof(AVFilterPad));

    newlinks = av_realloc_array(*links, *count + 1, sizeof(AVFilterLink*));

    if (newpads)

        *pads  = newpads;

    if (newlinks)

        *links = newlinks;

    if (!newpads || !newlinks)

        return AVERROR(ENOMEM);



    memmove(*pads  + idx + 1, *pads  + idx, sizeof(AVFilterPad)   * (*count - idx));

    memmove(*links + idx + 1, *links + idx, sizeof(AVFilterLink*) * (*count - idx));

    memcpy(*pads + idx, newpad, sizeof(AVFilterPad));

    (*links)[idx] = NULL;



    (*count)++;

    for (i = idx + 1; i < *count; i++)

        if (*links[i])

            (*(unsigned *)((uint8_t *) *links[i] + padidx_off))++;



    return 0;

}

        if (*links[i])             (*(unsigned *)((uint8_t *) *links[i] + padidx_off))++;
int FUNC_0(unsigned VAR_0, unsigned *VAR_1, size_t VAR_2,

                   AVFilterPad **VAR_3, AVFilterLink ***VAR_4,

                   AVFilterPad *VAR_5)

{

    AVFilterLink **newlinks;

    AVFilterPad *newpads;

    unsigned VAR_6;



    VAR_0 = FFMIN(VAR_0, *VAR_1);



    newpads  = av_realloc_array(*VAR_3,  *VAR_1 + 1, sizeof(AVFilterPad));

    newlinks = av_realloc_array(*VAR_4, *VAR_1 + 1, sizeof(AVFilterLink*));

    if (newpads)

        *VAR_3  = newpads;

    if (newlinks)

        *VAR_4 = newlinks;

    if (!newpads || !newlinks)

        return AVERROR(ENOMEM);



    memmove(*VAR_3  + VAR_0 + 1, *VAR_3  + VAR_0, sizeof(AVFilterPad)   * (*VAR_1 - VAR_0));

    memmove(*VAR_4 + VAR_0 + 1, *VAR_4 + VAR_0, sizeof(AVFilterLink*) * (*VAR_1 - VAR_0));

    memcpy(*VAR_3 + VAR_0, VAR_5, sizeof(AVFilterPad));

    (*VAR_4)[VAR_0] = NULL;



    (*VAR_1)++;

    for (VAR_6 = VAR_0 + 1; VAR_6 < *VAR_1; VAR_6++)

        if (*VAR_4[VAR_6])

            (*(unsigned *)((uint8_t *) *VAR_4[VAR_6] + VAR_2))++;



    return 0;

}

int FUNC_0(unsigned VAR_0, unsigned *VAR_1, size_t VAR_2,
AVFilterPad **VAR_3, AVFilterLink ***VAR_4,
AVFilterPad *VAR_5)
{ AVFilterLink **newlinks; AVFilterPad *newpads; unsigned VAR_6; VAR_0 = FFMIN(VAR_0, *VAR_1); newpads  = av_realloc_array(*VAR_3,  *VAR_1 + 1, sizeof(AVFilterPad)); newlinks = av_realloc_array(*VAR_4, *VAR_1 + 1, sizeof(AVFilterLink*)); if (newpads)
*VAR_3  = newpads; if (newlinks)
*VAR_4 = newlinks; if (!newpads || !newlinks)
return AVERROR(ENOMEM); memmove(*VAR_3  + VAR_0 + 1, *VAR_3  + VAR_0, sizeof(AVFilterPad)   * (*VAR_1 - VAR_0)); memmove(*VAR_4 + VAR_0 + 1, *VAR_4 + VAR_0, sizeof(AVFilterLink*) * (*VAR_1 - VAR_0)); memcpy(*VAR_3 + VAR_0, VAR_5, sizeof(AVFilterPad)); (*VAR_4)[VAR_0] = NULL; (*VAR_1)++; for (VAR_6 = VAR_0 + 1; VAR_6 < *VAR_1; VAR_6++) if (*VAR_4[VAR_6])
(*(unsigned *)((uint8_t *) *VAR_4[VAR_6] + VAR_2))++; return 0; }