int socket_connect(SocketAddress *addr, NonBlockingConnectHandler *callback,

                   void *opaque, Error **errp)

{

    int fd;



    switch (addr->type) {

    case SOCKET_ADDRESS_KIND_INET:

        fd = inet_connect_saddr(addr->u.inet.data, callback, opaque, errp);

        break;



    case SOCKET_ADDRESS_KIND_UNIX:

        fd = unix_connect_saddr(addr->u.q_unix.data, callback, opaque, errp);

        break;



    case SOCKET_ADDRESS_KIND_FD:

        fd = monitor_get_fd(cur_mon, addr->u.fd.data->str, errp);

        if (fd >= 0 && callback) {

            qemu_set_nonblock(fd);

            callback(fd, NULL, opaque);

        }

        break;



    case SOCKET_ADDRESS_KIND_VSOCK:

        fd = vsock_connect_saddr(addr->u.vsock.data, callback, opaque, errp);

        break;



    default:

        abort();

    }

    return fd;

}

int socket_connect(SocketAddress *addr, NonBlockingConnectHandler *callback,

                   void *opaque, Error **errp)

{

    int fd;



    switch (addr->type) {

    case SOCKET_ADDRESS_KIND_INET:

        fd = inet_connect_saddr(addr->u.inet.data, callback, opaque, errp);

        break;



    case SOCKET_ADDRESS_KIND_UNIX:

        fd = unix_connect_saddr(addr->u.q_unix.data, callback, opaque, errp);

        break;



    case SOCKET_ADDRESS_KIND_FD:

        fd = monitor_get_fd(cur_mon, addr->u.fd.data->str, errp);

        if (fd >= 0 && callback) {

            qemu_set_nonblock(fd);

            callback(fd, NULL, opaque);

        }

        break;



    case SOCKET_ADDRESS_KIND_VSOCK:

        fd = vsock_connect_saddr(addr->u.vsock.data, callback, opaque, errp);

        break;



    default:

        abort();

    }

    return fd;

}

int FUNC_0(SocketAddress *VAR_0, NonBlockingConnectHandler *VAR_1,

                   void *VAR_2, Error **VAR_3)

{

    int VAR_4;



    switch (VAR_0->type) {

    case SOCKET_ADDRESS_KIND_INET:

        VAR_4 = inet_connect_saddr(VAR_0->u.inet.data, VAR_1, VAR_2, VAR_3);

        break;



    case SOCKET_ADDRESS_KIND_UNIX:

        VAR_4 = unix_connect_saddr(VAR_0->u.q_unix.data, VAR_1, VAR_2, VAR_3);

        break;



    case SOCKET_ADDRESS_KIND_FD:

        VAR_4 = monitor_get_fd(cur_mon, VAR_0->u.VAR_4.data->str, VAR_3);

        if (VAR_4 >= 0 && VAR_1) {

            qemu_set_nonblock(VAR_4);

            VAR_1(VAR_4, NULL, VAR_2);

        }

        break;



    case SOCKET_ADDRESS_KIND_VSOCK:

        VAR_4 = vsock_connect_saddr(VAR_0->u.vsock.data, VAR_1, VAR_2, VAR_3);

        break;



    default:

        abort();

    }

    return VAR_4;

}

int FUNC_0(SocketAddress *VAR_0, NonBlockingConnectHandler *VAR_1,
void *VAR_2, Error **VAR_3)
{ int VAR_4; switch (VAR_0->type) { case SOCKET_ADDRESS_KIND_INET:
VAR_4 = inet_connect_saddr(VAR_0->u.inet.data, VAR_1, VAR_2, VAR_3); break; case SOCKET_ADDRESS_KIND_UNIX:
VAR_4 = unix_connect_saddr(VAR_0->u.q_unix.data, VAR_1, VAR_2, VAR_3); break; case SOCKET_ADDRESS_KIND_FD:
VAR_4 = monitor_get_fd(cur_mon, VAR_0->u.VAR_4.data->str, VAR_3); if (VAR_4 >= 0 && VAR_1) { qemu_set_nonblock(VAR_4); VAR_1(VAR_4, NULL, VAR_2); } break; case SOCKET_ADDRESS_KIND_VSOCK:
VAR_4 = vsock_connect_saddr(VAR_0->u.vsock.data, VAR_1, VAR_2, VAR_3); break; default:
abort(); } return VAR_4; }