static int slirp_state_load(QEMUFile *f, void *opaque, int version_id)

{

    Slirp *slirp = opaque;

    struct ex_list *ex_ptr;



    while (qemu_get_byte(f)) {

        int ret;

        struct socket *so = socreate(slirp);



        if (!so)

            return -ENOMEM;



        ret = vmstate_load_state(f, &vmstate_slirp_socket, so, version_id);



        if (ret < 0)

            return ret;



        if ((so->so_faddr.s_addr & slirp->vnetwork_mask.s_addr) !=

            slirp->vnetwork_addr.s_addr) {

            return -EINVAL;

        }

        for (ex_ptr = slirp->exec_list; ex_ptr; ex_ptr = ex_ptr->ex_next) {

            if (ex_ptr->ex_pty == 3 &&

                so->so_faddr.s_addr == ex_ptr->ex_addr.s_addr &&

                so->so_fport == ex_ptr->ex_fport) {

                break;

            }

        }

        if (!ex_ptr)

            return -EINVAL;



        so->extra = (void *)ex_ptr->ex_exec;

    }



    if (version_id >= 2) {

        slirp->ip_id = qemu_get_be16(f);

    }



    if (version_id >= 3) {

        slirp_bootp_load(f, slirp);

    }



    return 0;

}

static int slirp_state_load(QEMUFile *f, void *opaque, int version_id)

{

    Slirp *slirp = opaque;

    struct ex_list *ex_ptr;



    while (qemu_get_byte(f)) {

        int ret;

        struct socket *so = socreate(slirp);



        if (!so)

            return -ENOMEM;



        ret = vmstate_load_state(f, &vmstate_slirp_socket, so, version_id);



        if (ret < 0)

            return ret;



        if ((so->so_faddr.s_addr & slirp->vnetwork_mask.s_addr) !=

            slirp->vnetwork_addr.s_addr) {

            return -EINVAL;

        }

        for (ex_ptr = slirp->exec_list; ex_ptr; ex_ptr = ex_ptr->ex_next) {

            if (ex_ptr->ex_pty == 3 &&

                so->so_faddr.s_addr == ex_ptr->ex_addr.s_addr &&

                so->so_fport == ex_ptr->ex_fport) {

                break;

            }

        }

        if (!ex_ptr)

            return -EINVAL;



        so->extra = (void *)ex_ptr->ex_exec;

    }



    if (version_id >= 2) {

        slirp->ip_id = qemu_get_be16(f);

    }



    if (version_id >= 3) {

        slirp_bootp_load(f, slirp);

    }



    return 0;

}

static int FUNC_0(QEMUFile *VAR_0, void *VAR_1, int VAR_2)

{

    Slirp *slirp = VAR_1;

    struct ex_list *VAR_3;



    while (qemu_get_byte(VAR_0)) {

        int VAR_4;

        struct socket *VAR_5 = socreate(slirp);



        if (!VAR_5)

            return -ENOMEM;



        VAR_4 = vmstate_load_state(VAR_0, &vmstate_slirp_socket, VAR_5, VAR_2);



        if (VAR_4 < 0)

            return VAR_4;



        if ((VAR_5->so_faddr.s_addr & slirp->vnetwork_mask.s_addr) !=

            slirp->vnetwork_addr.s_addr) {

            return -EINVAL;

        }

        for (VAR_3 = slirp->exec_list; VAR_3; VAR_3 = VAR_3->ex_next) {

            if (VAR_3->ex_pty == 3 &&

                VAR_5->so_faddr.s_addr == VAR_3->ex_addr.s_addr &&

                VAR_5->so_fport == VAR_3->ex_fport) {

                break;

            }

        }

        if (!VAR_3)

            return -EINVAL;



        VAR_5->extra = (void *)VAR_3->ex_exec;

    }



    if (VAR_2 >= 2) {

        slirp->ip_id = qemu_get_be16(VAR_0);

    }



    if (VAR_2 >= 3) {

        slirp_bootp_load(VAR_0, slirp);

    }



    return 0;

}

static int FUNC_0(QEMUFile *VAR_0, void *VAR_1, int VAR_2)
{ Slirp *slirp = VAR_1; struct ex_list *VAR_3; while (qemu_get_byte(VAR_0)) { int VAR_4; struct socket *VAR_5 = socreate(slirp); if (!VAR_5)
return -ENOMEM; VAR_4 = vmstate_load_state(VAR_0, &vmstate_slirp_socket, VAR_5, VAR_2); if (VAR_4 < 0)
return VAR_4; if ((VAR_5->so_faddr.s_addr & slirp->vnetwork_mask.s_addr) !=
slirp->vnetwork_addr.s_addr) { return -EINVAL; } for (VAR_3 = slirp->exec_list; VAR_3; VAR_3 = VAR_3->ex_next) { if (VAR_3->ex_pty == 3 &&
VAR_5->so_faddr.s_addr == VAR_3->ex_addr.s_addr &&
VAR_5->so_fport == VAR_3->ex_fport) { break; } } if (!VAR_3)
return -EINVAL; VAR_5->extra = (void *)VAR_3->ex_exec; } if (VAR_2 >= 2) { slirp->ip_id = qemu_get_be16(VAR_0); } if (VAR_2 >= 3) { slirp_bootp_load(VAR_0, slirp); } return 0; }