static int vmstate_subsection_load(QEMUFile *f, const VMStateDescription *vmsd,

                                   void *opaque)

{

    while (qemu_peek_byte(f, 0) == QEMU_VM_SUBSECTION) {

        char idstr[256];

        int ret;

        uint8_t version_id, len, size;

        const VMStateDescription *sub_vmsd;



        len = qemu_peek_byte(f, 1);

        if (len < strlen(vmsd->name) + 1) {

            /* subsection name has be be "section_name/a" */

            return 0;

        }

        size = qemu_peek_buffer(f, (uint8_t *)idstr, len, 2);

        if (size != len) {

            return 0;

        }

        idstr[size] = 0;



        if (strncmp(vmsd->name, idstr, strlen(vmsd->name)) != 0) {

            /* it don't have a valid subsection name */

            return 0;

        }

        sub_vmsd = vmstate_get_subsection(vmsd->subsections, idstr);

        if (sub_vmsd == NULL) {

            return -ENOENT;

        }

        qemu_file_skip(f, 1); /* subsection */

        qemu_file_skip(f, 1); /* len */

        qemu_file_skip(f, len); /* idstr */

        version_id = qemu_get_be32(f);



        ret = vmstate_load_state(f, sub_vmsd, opaque, version_id);

        if (ret) {

            return ret;

        }

    }

    return 0;

}

static int vmstate_subsection_load(QEMUFile *f, const VMStateDescription *vmsd,

                                   void *opaque)

{

    while (qemu_peek_byte(f, 0) == QEMU_VM_SUBSECTION) {

        char idstr[256];

        int ret;

        uint8_t version_id, len, size;

        const VMStateDescription *sub_vmsd;



        len = qemu_peek_byte(f, 1);

        if (len < strlen(vmsd->name) + 1) {

            

            return 0;

        }

        size = qemu_peek_buffer(f, (uint8_t *)idstr, len, 2);

        if (size != len) {

            return 0;

        }

        idstr[size] = 0;



        if (strncmp(vmsd->name, idstr, strlen(vmsd->name)) != 0) {

            

            return 0;

        }

        sub_vmsd = vmstate_get_subsection(vmsd->subsections, idstr);

        if (sub_vmsd == NULL) {

            return -ENOENT;

        }

        qemu_file_skip(f, 1); 

        qemu_file_skip(f, 1); 

        qemu_file_skip(f, len); 

        version_id = qemu_get_be32(f);



        ret = vmstate_load_state(f, sub_vmsd, opaque, version_id);

        if (ret) {

            return ret;

        }

    }

    return 0;

}

static int FUNC_0(QEMUFile *VAR_0, const VMStateDescription *VAR_1,

                                   void *VAR_2)

{

    while (qemu_peek_byte(VAR_0, 0) == QEMU_VM_SUBSECTION) {

        char VAR_3[256];

        int VAR_4;

        uint8_t version_id, len, size;

        const VMStateDescription *VAR_5;



        len = qemu_peek_byte(VAR_0, 1);

        if (len < strlen(VAR_1->name) + 1) {

            

            return 0;

        }

        size = qemu_peek_buffer(VAR_0, (uint8_t *)VAR_3, len, 2);

        if (size != len) {

            return 0;

        }

        VAR_3[size] = 0;



        if (strncmp(VAR_1->name, VAR_3, strlen(VAR_1->name)) != 0) {

            

            return 0;

        }

        VAR_5 = vmstate_get_subsection(VAR_1->subsections, VAR_3);

        if (VAR_5 == NULL) {

            return -ENOENT;

        }

        qemu_file_skip(VAR_0, 1); 

        qemu_file_skip(VAR_0, 1); 

        qemu_file_skip(VAR_0, len); 

        version_id = qemu_get_be32(VAR_0);



        VAR_4 = vmstate_load_state(VAR_0, VAR_5, VAR_2, version_id);

        if (VAR_4) {

            return VAR_4;

        }

    }

    return 0;

}

static int FUNC_0(QEMUFile *VAR_0, const VMStateDescription *VAR_1,
void *VAR_2)
{ while (qemu_peek_byte(VAR_0, 0) == QEMU_VM_SUBSECTION) { char VAR_3[256]; int VAR_4; uint8_t version_id, len, size; const VMStateDescription *VAR_5; len = qemu_peek_byte(VAR_0, 1); if (len < strlen(VAR_1->name) + 1) { return 0; } size = qemu_peek_buffer(VAR_0, (uint8_t *)VAR_3, len, 2); if (size != len) { return 0; } VAR_3[size] = 0; if (strncmp(VAR_1->name, VAR_3, strlen(VAR_1->name)) != 0) { return 0; } VAR_5 = vmstate_get_subsection(VAR_1->subsections, VAR_3); if (VAR_5 == NULL) { return -ENOENT; } qemu_file_skip(VAR_0, 1); qemu_file_skip(VAR_0, 1); qemu_file_skip(VAR_0, len); version_id = qemu_get_be32(VAR_0); VAR_4 = vmstate_load_state(VAR_0, VAR_5, VAR_2, version_id); if (VAR_4) { return VAR_4; } } return 0; }