static void parse_str(StringInputVisitor *siv, Error **errp)

{

    char *str = (char *) siv->string;

    long long start, end;

    Range *cur;

    char *endptr;



    if (siv->ranges) {

        return;

    }



    do {

        errno = 0;

        start = strtoll(str, &endptr, 0);

        if (errno == 0 && endptr > str) {

            if (*endptr == '\0') {

                cur = g_malloc0(sizeof(*cur));

                cur->begin = start;

                cur->end = start + 1;

                siv->ranges = g_list_insert_sorted_merged(siv->ranges, cur,

                                                          range_compare);

                cur = NULL;

                str = NULL;

            } else if (*endptr == '-') {

                str = endptr + 1;

                errno = 0;

                end = strtoll(str, &endptr, 0);

                if (errno == 0 && endptr > str && start <= end &&

                    (start > INT64_MAX - 65536 ||

                     end < start + 65536)) {

                    if (*endptr == '\0') {

                        cur = g_malloc0(sizeof(*cur));

                        cur->begin = start;

                        cur->end = end + 1;

                        siv->ranges =

                            g_list_insert_sorted_merged(siv->ranges,

                                                        cur,

                                                        range_compare);

                        cur = NULL;

                        str = NULL;

                    } else if (*endptr == ',') {

                        str = endptr + 1;

                        cur = g_malloc0(sizeof(*cur));

                        cur->begin = start;

                        cur->end = end + 1;

                        siv->ranges =

                            g_list_insert_sorted_merged(siv->ranges,

                                                        cur,

                                                        range_compare);

                        cur = NULL;

                    } else {

                        goto error;

                    }

                } else {

                    goto error;

                }

            } else if (*endptr == ',') {

                str = endptr + 1;

                cur = g_malloc0(sizeof(*cur));

                cur->begin = start;

                cur->end = start + 1;

                siv->ranges = g_list_insert_sorted_merged(siv->ranges,

                                                          cur,

                                                          range_compare);

                cur = NULL;

            } else {

                goto error;

            }

        } else {

            goto error;

        }

    } while (str);



    return;

error:

    g_list_foreach(siv->ranges, free_range, NULL);

    g_list_free(siv->ranges);

    siv->ranges = NULL;

}

static void parse_str(StringInputVisitor *siv, Error **errp)

{

    char *str = (char *) siv->string;

    long long start, end;

    Range *cur;

    char *endptr;



    if (siv->ranges) {

        return;

    }



    do {

        errno = 0;

        start = strtoll(str, &endptr, 0);

        if (errno == 0 && endptr > str) {

            if (*endptr == '\0') {

                cur = g_malloc0(sizeof(*cur));

                cur->begin = start;

                cur->end = start + 1;

                siv->ranges = g_list_insert_sorted_merged(siv->ranges, cur,

                                                          range_compare);

                cur = NULL;

                str = NULL;

            } else if (*endptr == '-') {

                str = endptr + 1;

                errno = 0;

                end = strtoll(str, &endptr, 0);

                if (errno == 0 && endptr > str && start <= end &&

                    (start > INT64_MAX - 65536 ||

                     end < start + 65536)) {

                    if (*endptr == '\0') {

                        cur = g_malloc0(sizeof(*cur));

                        cur->begin = start;

                        cur->end = end + 1;

                        siv->ranges =

                            g_list_insert_sorted_merged(siv->ranges,

                                                        cur,

                                                        range_compare);

                        cur = NULL;

                        str = NULL;

                    } else if (*endptr == ',') {

                        str = endptr + 1;

                        cur = g_malloc0(sizeof(*cur));

                        cur->begin = start;

                        cur->end = end + 1;

                        siv->ranges =

                            g_list_insert_sorted_merged(siv->ranges,

                                                        cur,

                                                        range_compare);

                        cur = NULL;

                    } else {

                        goto error;

                    }

                } else {

                    goto error;

                }

            } else if (*endptr == ',') {

                str = endptr + 1;

                cur = g_malloc0(sizeof(*cur));

                cur->begin = start;

                cur->end = start + 1;

                siv->ranges = g_list_insert_sorted_merged(siv->ranges,

                                                          cur,

                                                          range_compare);

                cur = NULL;

            } else {

                goto error;

            }

        } else {

            goto error;

        }

    } while (str);



    return;

error:

    g_list_foreach(siv->ranges, free_range, NULL);

    g_list_free(siv->ranges);

    siv->ranges = NULL;

}

static void parse_str(StringInputVisitor *siv, Error **errp)
static void FUNC_0(StringInputVisitor *VAR_0, Error **VAR_1)

{

    char *VAR_2 = (char *) VAR_0->string;

    long long VAR_3, VAR_4;

    Range *cur;

    char *VAR_5;



    if (VAR_0->ranges) {

        return;

    }



    do {

        errno = 0;

        VAR_3 = strtoll(VAR_2, &VAR_5, 0);

        if (errno == 0 && VAR_5 > VAR_2) {

            if (*VAR_5 == '\0') {

                cur = g_malloc0(sizeof(*cur));

                cur->begin = VAR_3;

                cur->VAR_4 = VAR_3 + 1;

                VAR_0->ranges = g_list_insert_sorted_merged(VAR_0->ranges, cur,

                                                          range_compare);

                cur = NULL;

                VAR_2 = NULL;

            } else if (*VAR_5 == '-') {

                VAR_2 = VAR_5 + 1;

                errno = 0;

                VAR_4 = strtoll(VAR_2, &VAR_5, 0);

                if (errno == 0 && VAR_5 > VAR_2 && VAR_3 <= VAR_4 &&

                    (VAR_3 > INT64_MAX - 65536 ||

                     VAR_4 < VAR_3 + 65536)) {

                    if (*VAR_5 == '\0') {

                        cur = g_malloc0(sizeof(*cur));

                        cur->begin = VAR_3;

                        cur->VAR_4 = VAR_4 + 1;

                        VAR_0->ranges =

                            g_list_insert_sorted_merged(VAR_0->ranges,

                                                        cur,

                                                        range_compare);

                        cur = NULL;

                        VAR_2 = NULL;

                    } else if (*VAR_5 == ',') {

                        VAR_2 = VAR_5 + 1;

                        cur = g_malloc0(sizeof(*cur));

                        cur->begin = VAR_3;

                        cur->VAR_4 = VAR_4 + 1;

                        VAR_0->ranges =

                            g_list_insert_sorted_merged(VAR_0->ranges,

                                                        cur,

                                                        range_compare);

                        cur = NULL;

                    } else {

                        goto error;

                    }

                } else {

                    goto error;

                }

            } else if (*VAR_5 == ',') {

                VAR_2 = VAR_5 + 1;

                cur = g_malloc0(sizeof(*cur));

                cur->begin = VAR_3;

                cur->VAR_4 = VAR_3 + 1;

                VAR_0->ranges = g_list_insert_sorted_merged(VAR_0->ranges,

                                                          cur,

                                                          range_compare);

                cur = NULL;

            } else {

                goto error;

            }

        } else {

            goto error;

        }

    } while (VAR_2);



    return;

error:

    g_list_foreach(VAR_0->ranges, free_range, NULL);

    g_list_free(VAR_0->ranges);

    VAR_0->ranges = NULL;

}

static void FUNC_0(StringInputVisitor *VAR_0, Error **VAR_1)
{ char *VAR_2 = (char *) VAR_0->string; long long VAR_3, VAR_4; Range *cur; char *VAR_5; if (VAR_0->ranges) { return; } do { errno = 0; VAR_3 = strtoll(VAR_2, &VAR_5, 0); if (errno == 0 && VAR_5 > VAR_2) { if (*VAR_5 == '\0') { cur = g_malloc0(sizeof(*cur)); cur->begin = VAR_3; cur->VAR_4 = VAR_3 + 1; VAR_0->ranges = g_list_insert_sorted_merged(VAR_0->ranges, cur,
range_compare); cur = NULL; VAR_2 = NULL; } else if (*VAR_5 == '-') { VAR_2 = VAR_5 + 1; errno = 0; VAR_4 = strtoll(VAR_2, &VAR_5, 0); if (errno == 0 && VAR_5 > VAR_2 && VAR_3 <= VAR_4 &&
(VAR_3 > INT64_MAX - 65536 ||
VAR_4 < VAR_3 + 65536)) { if (*VAR_5 == '\0') { cur = g_malloc0(sizeof(*cur)); cur->begin = VAR_3; cur->VAR_4 = VAR_4 + 1; VAR_0->ranges =
g_list_insert_sorted_merged(VAR_0->ranges,
cur,
range_compare); cur = NULL; VAR_2 = NULL; } else if (*VAR_5 == ',') { VAR_2 = VAR_5 + 1; cur = g_malloc0(sizeof(*cur)); cur->begin = VAR_3; cur->VAR_4 = VAR_4 + 1; VAR_0->ranges =
g_list_insert_sorted_merged(VAR_0->ranges,
cur,
range_compare); cur = NULL; } else { goto error; } } else { goto error; } } else if (*VAR_5 == ',') { VAR_2 = VAR_5 + 1; cur = g_malloc0(sizeof(*cur)); cur->begin = VAR_3; cur->VAR_4 = VAR_3 + 1; VAR_0->ranges = g_list_insert_sorted_merged(VAR_0->ranges,
cur,
range_compare); cur = NULL; } else { goto error; } } else { goto error; } } while (VAR_2); return; error:
g_list_foreach(VAR_0->ranges, free_range, NULL); g_list_free(VAR_0->ranges); VAR_0->ranges = NULL; }