int vmstate_register_with_alias_id(DeviceState *dev, int instance_id,

                                   const VMStateDescription *vmsd,

                                   void *opaque, int alias_id,

                                   int required_for_version)

{

    SaveStateEntry *se;



    /* If this triggers, alias support can be dropped for the vmsd. */

    assert(alias_id == -1 || required_for_version >= vmsd->minimum_version_id);



    se = g_malloc0(sizeof(SaveStateEntry));

    se->version_id = vmsd->version_id;

    se->section_id = savevm_state.global_section_id++;

    se->opaque = opaque;

    se->vmsd = vmsd;

    se->alias_id = alias_id;



    if (dev) {

        char *id = qdev_get_dev_path(dev);

        if (id) {

            pstrcpy(se->idstr, sizeof(se->idstr), id);

            pstrcat(se->idstr, sizeof(se->idstr), "/");

            g_free(id);



            se->compat = g_malloc0(sizeof(CompatEntry));

            pstrcpy(se->compat->idstr, sizeof(se->compat->idstr), vmsd->name);

            se->compat->instance_id = instance_id == -1 ?

                         calculate_compat_instance_id(vmsd->name) : instance_id;

            instance_id = -1;

        }

    }

    pstrcat(se->idstr, sizeof(se->idstr), vmsd->name);



    if (instance_id == -1) {

        se->instance_id = calculate_new_instance_id(se->idstr);

    } else {

        se->instance_id = instance_id;

    }

    assert(!se->compat || se->instance_id == 0);

    /* add at the end of list */

    QTAILQ_INSERT_TAIL(&savevm_state.handlers, se, entry);

    return 0;

}

int vmstate_register_with_alias_id(DeviceState *dev, int instance_id,

                                   const VMStateDescription *vmsd,

                                   void *opaque, int alias_id,

                                   int required_for_version)

{

    SaveStateEntry *se;



    

    assert(alias_id == -1 || required_for_version >= vmsd->minimum_version_id);



    se = g_malloc0(sizeof(SaveStateEntry));

    se->version_id = vmsd->version_id;

    se->section_id = savevm_state.global_section_id++;

    se->opaque = opaque;

    se->vmsd = vmsd;

    se->alias_id = alias_id;



    if (dev) {

        char *id = qdev_get_dev_path(dev);

        if (id) {

            pstrcpy(se->idstr, sizeof(se->idstr), id);

            pstrcat(se->idstr, sizeof(se->idstr), "/");

            g_free(id);



            se->compat = g_malloc0(sizeof(CompatEntry));

            pstrcpy(se->compat->idstr, sizeof(se->compat->idstr), vmsd->name);

            se->compat->instance_id = instance_id == -1 ?

                         calculate_compat_instance_id(vmsd->name) : instance_id;

            instance_id = -1;

        }

    }

    pstrcat(se->idstr, sizeof(se->idstr), vmsd->name);



    if (instance_id == -1) {

        se->instance_id = calculate_new_instance_id(se->idstr);

    } else {

        se->instance_id = instance_id;

    }

    assert(!se->compat || se->instance_id == 0);

    

    QTAILQ_INSERT_TAIL(&savevm_state.handlers, se, entry);

    return 0;

}

    se = g_malloc0(sizeof(SaveStateEntry));             se->compat = g_malloc0(sizeof(CompatEntry));     se = g_malloc0(sizeof(SaveStateEntry));             se->compat = g_malloc0(sizeof(CompatEntry));
int FUNC_0(DeviceState *VAR_0, int VAR_1,

                                   const VMStateDescription *VAR_2,

                                   void *VAR_3, int VAR_4,

                                   int VAR_5)

{

    SaveStateEntry *se;



    

    assert(VAR_4 == -1 || VAR_5 >= VAR_2->minimum_version_id);



    se = g_malloc0(sizeof(SaveStateEntry));

    se->version_id = VAR_2->version_id;

    se->section_id = savevm_state.global_section_id++;

    se->VAR_3 = VAR_3;

    se->VAR_2 = VAR_2;

    se->VAR_4 = VAR_4;



    if (VAR_0) {

        char *VAR_6 = qdev_get_dev_path(VAR_0);

        if (VAR_6) {

            pstrcpy(se->idstr, sizeof(se->idstr), VAR_6);

            pstrcat(se->idstr, sizeof(se->idstr), "/");

            g_free(VAR_6);



            se->compat = g_malloc0(sizeof(CompatEntry));

            pstrcpy(se->compat->idstr, sizeof(se->compat->idstr), VAR_2->name);

            se->compat->VAR_1 = VAR_1 == -1 ?

                         calculate_compat_instance_id(VAR_2->name) : VAR_1;

            VAR_1 = -1;

        }

    }

    pstrcat(se->idstr, sizeof(se->idstr), VAR_2->name);



    if (VAR_1 == -1) {

        se->VAR_1 = calculate_new_instance_id(se->idstr);

    } else {

        se->VAR_1 = VAR_1;

    }

    assert(!se->compat || se->VAR_1 == 0);

    

    QTAILQ_INSERT_TAIL(&savevm_state.handlers, se, entry);

    return 0;

}

int FUNC_0(DeviceState *VAR_0, int VAR_1,
const VMStateDescription *VAR_2,
void *VAR_3, int VAR_4,
int VAR_5)
{ SaveStateEntry *se; assert(VAR_4 == -1 || VAR_5 >= VAR_2->minimum_version_id); se = g_malloc0(sizeof(SaveStateEntry)); se->version_id = VAR_2->version_id; se->section_id = savevm_state.global_section_id++; se->VAR_3 = VAR_3; se->VAR_2 = VAR_2; se->VAR_4 = VAR_4; if (VAR_0) { char *VAR_6 = qdev_get_dev_path(VAR_0); if (VAR_6) { pstrcpy(se->idstr, sizeof(se->idstr), VAR_6); pstrcat(se->idstr, sizeof(se->idstr), "/"); g_free(VAR_6); se->compat = g_malloc0(sizeof(CompatEntry)); pstrcpy(se->compat->idstr, sizeof(se->compat->idstr), VAR_2->name); se->compat->VAR_1 = VAR_1 == -1 ?
calculate_compat_instance_id(VAR_2->name) : VAR_1; VAR_1 = -1; } } pstrcat(se->idstr, sizeof(se->idstr), VAR_2->name); if (VAR_1 == -1) { se->VAR_1 = calculate_new_instance_id(se->idstr); } else { se->VAR_1 = VAR_1; } assert(!se->compat || se->VAR_1 == 0); QTAILQ_INSERT_TAIL(&savevm_state.handlers, se, entry); return 0; }