static int64_t *concat_channels_lists(const int64_t *layouts, const int *counts)

{

    int nb_layouts = 0, nb_counts = 0, i;

    int64_t *list;



    if (layouts)

        for (; layouts[nb_layouts] != -1; nb_layouts++);

    if (counts)

        for (; counts[nb_counts] != -1; nb_counts++);

    if (nb_counts > INT_MAX - 1 - nb_layouts)

        return NULL;

    if (!(list = av_calloc(nb_layouts + nb_counts + 1, sizeof(*list))))

        return NULL;

    for (i = 0; i < nb_layouts; i++)

        list[i] = layouts[i];

    for (i = 0; i < nb_counts; i++)

        list[nb_layouts + i] = FF_COUNT2LAYOUT(counts[i]);

    list[nb_layouts + nb_counts] = -1;

    return list;

}

static int64_t *concat_channels_lists(const int64_t *layouts, const int *counts)

{

    int nb_layouts = 0, nb_counts = 0, i;

    int64_t *list;



    if (layouts)

        for (; layouts[nb_layouts] != -1; nb_layouts++);

    if (counts)

        for (; counts[nb_counts] != -1; nb_counts++);

    if (nb_counts > INT_MAX - 1 - nb_layouts)

        return NULL;

    if (!(list = av_calloc(nb_layouts + nb_counts + 1, sizeof(*list))))

        return NULL;

    for (i = 0; i < nb_layouts; i++)

        list[i] = layouts[i];

    for (i = 0; i < nb_counts; i++)

        list[nb_layouts + i] = FF_COUNT2LAYOUT(counts[i]);

    list[nb_layouts + nb_counts] = -1;

    return list;

}

static int64_t *FUNC_0(const int64_t *layouts, const int *counts)

{

    int VAR_0 = 0, VAR_1 = 0, VAR_2;

    int64_t *list;



    if (layouts)

        for (; layouts[VAR_0] != -1; VAR_0++);

    if (counts)

        for (; counts[VAR_1] != -1; VAR_1++);

    if (VAR_1 > INT_MAX - 1 - VAR_0)

        return NULL;

    if (!(list = av_calloc(VAR_0 + VAR_1 + 1, sizeof(*list))))

        return NULL;

    for (VAR_2 = 0; VAR_2 < VAR_0; VAR_2++)

        list[VAR_2] = layouts[VAR_2];

    for (VAR_2 = 0; VAR_2 < VAR_1; VAR_2++)

        list[VAR_0 + VAR_2] = FF_COUNT2LAYOUT(counts[VAR_2]);

    list[VAR_0 + VAR_1] = -1;

    return list;

}

static int64_t *FUNC_0(const int64_t *layouts, const int *counts)
{ int VAR_0 = 0, VAR_1 = 0, VAR_2; int64_t *list; if (layouts)
for (; layouts[VAR_0] != -1; VAR_0++); if (counts)
for (; counts[VAR_1] != -1; VAR_1++); if (VAR_1 > INT_MAX - 1 - VAR_0)
return NULL; if (!(list = av_calloc(VAR_0 + VAR_1 + 1, sizeof(*list))))
return NULL; for (VAR_2 = 0; VAR_2 < VAR_0; VAR_2++) list[VAR_2] = layouts[VAR_2]; for (VAR_2 = 0; VAR_2 < VAR_1; VAR_2++) list[VAR_0 + VAR_2] = FF_COUNT2LAYOUT(counts[VAR_2]); list[VAR_0 + VAR_1] = -1; return list; }