int inet_connect_opts(QemuOpts *opts, bool block, bool *in_progress,

                      Error **errp)

{

    struct addrinfo *res, *e;

    int sock = -1;



    res = inet_parse_connect_opts(opts, errp);

    if (!res) {

        return -1;

    }



    if (in_progress) {

        *in_progress = false;

    }



    for (e = res; e != NULL; e = e->ai_next) {

        sock = inet_connect_addr(e, block, in_progress);

        if (sock >= 0) {

            break;

        }

    }

    if (sock < 0) {

        error_set(errp, QERR_SOCKET_CONNECT_FAILED);

    }

    freeaddrinfo(res);

    return sock;

}

int inet_connect_opts(QemuOpts *opts, bool block, bool *in_progress,

                      Error **errp)

{

    struct addrinfo *res, *e;

    int sock = -1;



    res = inet_parse_connect_opts(opts, errp);

    if (!res) {

        return -1;

    }



    if (in_progress) {

        *in_progress = false;

    }



    for (e = res; e != NULL; e = e->ai_next) {

        sock = inet_connect_addr(e, block, in_progress);

        if (sock >= 0) {

            break;

        }

    }

    if (sock < 0) {

        error_set(errp, QERR_SOCKET_CONNECT_FAILED);

    }

    freeaddrinfo(res);

    return sock;

}

    if (in_progress) {     if (in_progress) {         *in_progress = false; int inet_connect_opts(QemuOpts *opts, bool block, bool *in_progress,                       Error **errp)     if (in_progress) {         *in_progress = false;         sock = inet_connect_addr(e, block, in_progress);         if (sock >= 0) { int inet_connect_opts(QemuOpts *opts, bool block, bool *in_progress,
int FUNC_0(QemuOpts *VAR_0, bool VAR_1, bool *VAR_2,

                      Error **VAR_3)

{

    struct addrinfo *VAR_4, *VAR_5;

    int VAR_6 = -1;



    VAR_4 = inet_parse_connect_opts(VAR_0, VAR_3);

    if (!VAR_4) {

        return -1;

    }



    if (VAR_2) {

        *VAR_2 = false;

    }



    for (VAR_5 = VAR_4; VAR_5 != NULL; VAR_5 = VAR_5->ai_next) {

        VAR_6 = inet_connect_addr(VAR_5, VAR_1, VAR_2);

        if (VAR_6 >= 0) {

            break;

        }

    }

    if (VAR_6 < 0) {

        error_set(VAR_3, QERR_SOCKET_CONNECT_FAILED);

    }

    freeaddrinfo(VAR_4);

    return VAR_6;

}

int FUNC_0(QemuOpts *VAR_0, bool VAR_1, bool *VAR_2,
Error **VAR_3)
{ struct addrinfo *VAR_4, *VAR_5; int VAR_6 = -1; VAR_4 = inet_parse_connect_opts(VAR_0, VAR_3); if (!VAR_4) { return -1; } if (VAR_2) { *VAR_2 = false; } for (VAR_5 = VAR_4; VAR_5 != NULL; VAR_5 = VAR_5->ai_next) { VAR_6 = inet_connect_addr(VAR_5, VAR_1, VAR_2); if (VAR_6 >= 0) { break; } } if (VAR_6 < 0) { error_set(VAR_3, QERR_SOCKET_CONNECT_FAILED); } freeaddrinfo(VAR_4); return VAR_6; }