int socket_connect(SocketAddress *addr, Error **errp,

                   NonBlockingConnectHandler *callback, void *opaque)

{

    int fd;



    switch (addr->type) {

    case SOCKET_ADDRESS_KIND_INET:

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

        break;



    case SOCKET_ADDRESS_KIND_UNIX:

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

        break;



    case SOCKET_ADDRESS_KIND_FD:

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

        if (fd >= 0 && callback) {

            qemu_set_nonblock(fd);

            callback(fd, NULL, opaque);

        }

        break;



    default:

        abort();

    }

    return fd;

}

int socket_connect(SocketAddress *addr, Error **errp,

                   NonBlockingConnectHandler *callback, void *opaque)

{

    int fd;



    switch (addr->type) {

    case SOCKET_ADDRESS_KIND_INET:

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

        break;



    case SOCKET_ADDRESS_KIND_UNIX:

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

        break;



    case SOCKET_ADDRESS_KIND_FD:

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

        if (fd >= 0 && callback) {

            qemu_set_nonblock(fd);

            callback(fd, NULL, opaque);

        }

        break;



    default:

        abort();

    }

    return fd;

}

int FUNC_0(SocketAddress *VAR_0, Error **VAR_1,

                   NonBlockingConnectHandler *VAR_2, void *VAR_3)

{

    int VAR_4;



    switch (VAR_0->type) {

    case SOCKET_ADDRESS_KIND_INET:

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

        break;



    case SOCKET_ADDRESS_KIND_UNIX:

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

        break;



    case SOCKET_ADDRESS_KIND_FD:

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

        if (VAR_4 >= 0 && VAR_2) {

            qemu_set_nonblock(VAR_4);

            VAR_2(VAR_4, NULL, VAR_3);

        }

        break;



    default:

        abort();

    }

    return VAR_4;

}

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