int check_params(const char * const *params, const char *str)

{

    int name_buf_size = 1;

    const char *p;

    char *name_buf;

    int i, len;

    int ret = 0;



    for (i = 0; params[i] != NULL; i++) {

        len = strlen(params[i]) + 1;

        if (len > name_buf_size) {

            name_buf_size = len;

        }

    }

    name_buf = qemu_malloc(name_buf_size);



    p = str;

    while (*p != '\0') {

        p = get_opt_name(name_buf, name_buf_size, p, '=');

        if (*p != '=') {

            ret = -1;

            break;

        }

        p++;

        for(i = 0; params[i] != NULL; i++)

            if (!strcmp(params[i], name_buf))

                break;

        if (params[i] == NULL) {

            ret = -1;

            break;

        }

        p = get_opt_value(NULL, 0, p);

        if (*p != ',')

            break;

        p++;

    }



    qemu_free(name_buf);

    return ret;

}

int check_params(const char * const *params, const char *str)

{

    int name_buf_size = 1;

    const char *p;

    char *name_buf;

    int i, len;

    int ret = 0;



    for (i = 0; params[i] != NULL; i++) {

        len = strlen(params[i]) + 1;

        if (len > name_buf_size) {

            name_buf_size = len;

        }

    }

    name_buf = qemu_malloc(name_buf_size);



    p = str;

    while (*p != '\0') {

        p = get_opt_name(name_buf, name_buf_size, p, '=');

        if (*p != '=') {

            ret = -1;

            break;

        }

        p++;

        for(i = 0; params[i] != NULL; i++)

            if (!strcmp(params[i], name_buf))

                break;

        if (params[i] == NULL) {

            ret = -1;

            break;

        }

        p = get_opt_value(NULL, 0, p);

        if (*p != ',')

            break;

        p++;

    }



    qemu_free(name_buf);

    return ret;

}

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

{

    int VAR_2 = 1;

    const char *VAR_3;

    char *VAR_4;

    int VAR_5, VAR_6;

    int VAR_7 = 0;



    for (VAR_5 = 0; VAR_0[VAR_5] != NULL; VAR_5++) {

        VAR_6 = strlen(VAR_0[VAR_5]) + 1;

        if (VAR_6 > VAR_2) {

            VAR_2 = VAR_6;

        }

    }

    VAR_4 = qemu_malloc(VAR_2);



    VAR_3 = VAR_1;

    while (*VAR_3 != '\0') {

        VAR_3 = get_opt_name(VAR_4, VAR_2, VAR_3, '=');

        if (*VAR_3 != '=') {

            VAR_7 = -1;

            break;

        }

        VAR_3++;

        for(VAR_5 = 0; VAR_0[VAR_5] != NULL; VAR_5++)

            if (!strcmp(VAR_0[VAR_5], VAR_4))

                break;

        if (VAR_0[VAR_5] == NULL) {

            VAR_7 = -1;

            break;

        }

        VAR_3 = get_opt_value(NULL, 0, VAR_3);

        if (*VAR_3 != ',')

            break;

        VAR_3++;

    }



    qemu_free(VAR_4);

    return VAR_7;

}

int FUNC_0(const char * const *VAR_0, const char *VAR_1)
{ int VAR_2 = 1; const char *VAR_3; char *VAR_4; int VAR_5, VAR_6; int VAR_7 = 0; for (VAR_5 = 0; VAR_0[VAR_5] != NULL; VAR_5++) { VAR_6 = strlen(VAR_0[VAR_5]) + 1; if (VAR_6 > VAR_2) { VAR_2 = VAR_6; } } VAR_4 = qemu_malloc(VAR_2); VAR_3 = VAR_1; while (*VAR_3 != '\0') { VAR_3 = get_opt_name(VAR_4, VAR_2, VAR_3, '='); if (*VAR_3 != '=') { VAR_7 = -1; break; } VAR_3++; for(VAR_5 = 0; VAR_0[VAR_5] != NULL; VAR_5++) if (!strcmp(VAR_0[VAR_5], VAR_4))
break; if (VAR_0[VAR_5] == NULL) { VAR_7 = -1; break; } VAR_3 = get_opt_value(NULL, 0, VAR_3); if (*VAR_3 != ',')
break; VAR_3++; } qemu_free(VAR_4); return VAR_7; }