static int ass_split(ASSSplitContext *ctx, const char *buf)

{

    char c, section[16];

    int i;



    if (ctx->current_section >= 0)

        buf = ass_split_section(ctx, buf);



    while (buf && *buf) {

        if (sscanf(buf, "[%15[0-9A-Za-z+ ]]%c", section, &c) == 2) {

            buf += strcspn(buf, "\n") + 1;

            for (i=0; i<FF_ARRAY_ELEMS(ass_sections); i++)

                if (!strcmp(section, ass_sections[i].section)) {

                    ctx->current_section = i;

                    buf = ass_split_section(ctx, buf);

                }

        } else

            buf += strcspn(buf, "\n") + 1;

    }

    return buf ? 0 : AVERROR_INVALIDDATA;

}

static int ass_split(ASSSplitContext *ctx, const char *buf)

{

    char c, section[16];

    int i;



    if (ctx->current_section >= 0)

        buf = ass_split_section(ctx, buf);



    while (buf && *buf) {

        if (sscanf(buf, "[%15[0-9A-Za-z+ ]]%c", section, &c) == 2) {

            buf += strcspn(buf, "\n") + 1;

            for (i=0; i<FF_ARRAY_ELEMS(ass_sections); i++)

                if (!strcmp(section, ass_sections[i].section)) {

                    ctx->current_section = i;

                    buf = ass_split_section(ctx, buf);

                }

        } else

            buf += strcspn(buf, "\n") + 1;

    }

    return buf ? 0 : AVERROR_INVALIDDATA;

}

static int FUNC_0(ASSSplitContext *VAR_0, const char *VAR_1)

{

    char VAR_2, VAR_3[16];

    int VAR_4;



    if (VAR_0->current_section >= 0)

        VAR_1 = ass_split_section(VAR_0, VAR_1);



    while (VAR_1 && *VAR_1) {

        if (sscanf(VAR_1, "[%15[0-9A-Za-z+ ]]%VAR_2", VAR_3, &VAR_2) == 2) {

            VAR_1 += strcspn(VAR_1, "\n") + 1;

            for (VAR_4=0; VAR_4<FF_ARRAY_ELEMS(ass_sections); VAR_4++)

                if (!strcmp(VAR_3, ass_sections[VAR_4].VAR_3)) {

                    VAR_0->current_section = VAR_4;

                    VAR_1 = ass_split_section(VAR_0, VAR_1);

                }

        } else

            VAR_1 += strcspn(VAR_1, "\n") + 1;

    }

    return VAR_1 ? 0 : AVERROR_INVALIDDATA;

}

static int FUNC_0(ASSSplitContext *VAR_0, const char *VAR_1)
{ char VAR_2, VAR_3[16]; int VAR_4; if (VAR_0->current_section >= 0)
VAR_1 = ass_split_section(VAR_0, VAR_1); while (VAR_1 && *VAR_1) { if (sscanf(VAR_1, "[%15[0-9A-Za-z+ ]]%VAR_2", VAR_3, &VAR_2) == 2) { VAR_1 += strcspn(VAR_1, "\n") + 1; for (VAR_4=0; VAR_4<FF_ARRAY_ELEMS(ass_sections); VAR_4++) if (!strcmp(VAR_3, ass_sections[VAR_4].VAR_3)) { VAR_0->current_section = VAR_4; VAR_1 = ass_split_section(VAR_0, VAR_1); } } else VAR_1 += strcspn(VAR_1, "\n") + 1; } return VAR_1 ? 0 : AVERROR_INVALIDDATA; }