X86CPU *cpu_x86_create(const char *cpu_model, Error **errp)

{

    X86CPU *cpu = NULL;

    ObjectClass *oc;

    CPUClass *cc;

    gchar **model_pieces;

    char *name, *features;

    Error *error = NULL;

    const char *typename;



    model_pieces = g_strsplit(cpu_model, ",", 2);

    if (!model_pieces[0]) {

        error_setg(&error, "Invalid/empty CPU model name");

        goto out;

    }

    name = model_pieces[0];

    features = model_pieces[1];



    oc = x86_cpu_class_by_name(name);

    if (oc == NULL) {

        error_setg(&error, "Unable to find CPU definition: %s", name);

        goto out;

    }

    cc = CPU_CLASS(oc);

    typename = object_class_get_name(oc);



    cc->parse_features(typename, features, &error);

    cpu = X86_CPU(object_new(typename));

    if (error) {

        goto out;

    }



out:

    if (error != NULL) {

        error_propagate(errp, error);

        if (cpu) {

            object_unref(OBJECT(cpu));

            cpu = NULL;

        }

    }

    g_strfreev(model_pieces);

    return cpu;

}

X86CPU *cpu_x86_create(const char *cpu_model, Error **errp)

{

    X86CPU *cpu = NULL;

    ObjectClass *oc;

    CPUClass *cc;

    gchar **model_pieces;

    char *name, *features;

    Error *error = NULL;

    const char *typename;



    model_pieces = g_strsplit(cpu_model, ",", 2);

    if (!model_pieces[0]) {

        error_setg(&error, "Invalid/empty CPU model name");

        goto out;

    }

    name = model_pieces[0];

    features = model_pieces[1];



    oc = x86_cpu_class_by_name(name);

    if (oc == NULL) {

        error_setg(&error, "Unable to find CPU definition: %s", name);

        goto out;

    }

    cc = CPU_CLASS(oc);

    typename = object_class_get_name(oc);



    cc->parse_features(typename, features, &error);

    cpu = X86_CPU(object_new(typename));

    if (error) {

        goto out;

    }



out:

    if (error != NULL) {

        error_propagate(errp, error);

        if (cpu) {

            object_unref(OBJECT(cpu));

            cpu = NULL;

        }

    }

    g_strfreev(model_pieces);

    return cpu;

}

X86CPU *FUNC_0(const char *cpu_model, Error **errp)

{

    X86CPU *cpu = NULL;

    ObjectClass *oc;

    CPUClass *cc;

    gchar **model_pieces;

    char *VAR_0, *VAR_1;

    Error *error = NULL;

    const char *VAR_2;



    model_pieces = g_strsplit(cpu_model, ",", 2);

    if (!model_pieces[0]) {

        error_setg(&error, "Invalid/empty CPU model VAR_0");

        goto out;

    }

    VAR_0 = model_pieces[0];

    VAR_1 = model_pieces[1];



    oc = x86_cpu_class_by_name(VAR_0);

    if (oc == NULL) {

        error_setg(&error, "Unable to find CPU definition: %s", VAR_0);

        goto out;

    }

    cc = CPU_CLASS(oc);

    VAR_2 = object_class_get_name(oc);



    cc->parse_features(VAR_2, VAR_1, &error);

    cpu = X86_CPU(object_new(VAR_2));

    if (error) {

        goto out;

    }



out:

    if (error != NULL) {

        error_propagate(errp, error);

        if (cpu) {

            object_unref(OBJECT(cpu));

            cpu = NULL;

        }

    }

    g_strfreev(model_pieces);

    return cpu;

}

X86CPU *FUNC_0(const char *cpu_model, Error **errp)
{ X86CPU *cpu = NULL; ObjectClass *oc; CPUClass *cc; gchar **model_pieces; char *VAR_0, *VAR_1; Error *error = NULL; const char *VAR_2; model_pieces = g_strsplit(cpu_model, ",", 2); if (!model_pieces[0]) { error_setg(&error, "Invalid/empty CPU model VAR_0"); goto out; } VAR_0 = model_pieces[0]; VAR_1 = model_pieces[1]; oc = x86_cpu_class_by_name(VAR_0); if (oc == NULL) { error_setg(&error, "Unable to find CPU definition: %s", VAR_0); goto out; } cc = CPU_CLASS(oc); VAR_2 = object_class_get_name(oc); cc->parse_features(VAR_2, VAR_1, &error); cpu = X86_CPU(object_new(VAR_2)); if (error) { goto out; } out:
if (error != NULL) { error_propagate(errp, error); if (cpu) { object_unref(OBJECT(cpu)); cpu = NULL; } } g_strfreev(model_pieces); return cpu; }