static struct addrinfo *inet_parse_connect_opts(QemuOpts *opts, Error **errp)

{

    struct addrinfo ai, *res;

    int rc;

    const char *addr;

    const char *port;



    memset(&ai, 0, sizeof(ai));



    ai.ai_flags = AI_CANONNAME | AI_ADDRCONFIG;

    ai.ai_family = PF_UNSPEC;

    ai.ai_socktype = SOCK_STREAM;



    addr = qemu_opt_get(opts, "host");

    port = qemu_opt_get(opts, "port");

    if (addr == NULL || port == NULL) {

        error_setg(errp, "host and/or port not specified");

        return NULL;

    }



    if (qemu_opt_get_bool(opts, "ipv4", 0)) {

        ai.ai_family = PF_INET;

    }

    if (qemu_opt_get_bool(opts, "ipv6", 0)) {

        ai.ai_family = PF_INET6;

    }



    /* lookup */

    rc = getaddrinfo(addr, port, &ai, &res);

    if (rc != 0) {

        error_setg(errp, "address resolution failed for %s:%s: %s", addr, port,

                   gai_strerror(rc));

        return NULL;

    }

    return res;

}

static struct addrinfo *inet_parse_connect_opts(QemuOpts *opts, Error **errp)

{

    struct addrinfo ai, *res;

    int rc;

    const char *addr;

    const char *port;



    memset(&ai, 0, sizeof(ai));



    ai.ai_flags = AI_CANONNAME | AI_ADDRCONFIG;

    ai.ai_family = PF_UNSPEC;

    ai.ai_socktype = SOCK_STREAM;



    addr = qemu_opt_get(opts, "host");

    port = qemu_opt_get(opts, "port");

    if (addr == NULL || port == NULL) {

        error_setg(errp, "host and/or port not specified");

        return NULL;

    }



    if (qemu_opt_get_bool(opts, "ipv4", 0)) {

        ai.ai_family = PF_INET;

    }

    if (qemu_opt_get_bool(opts, "ipv6", 0)) {

        ai.ai_family = PF_INET6;

    }



    

    rc = getaddrinfo(addr, port, &ai, &res);

    if (rc != 0) {

        error_setg(errp, "address resolution failed for %s:%s: %s", addr, port,

                   gai_strerror(rc));

        return NULL;

    }

    return res;

}

    ai.ai_flags = AI_CANONNAME | AI_ADDRCONFIG;     ai.ai_flags = AI_CANONNAME | AI_ADDRCONFIG;
static struct addrinfo *FUNC_0(QemuOpts *VAR_0, Error **VAR_1)

{

    struct addrinfo VAR_2, *VAR_3;

    int VAR_4;

    const char *VAR_5;

    const char *VAR_6;



    memset(&VAR_2, 0, sizeof(VAR_2));



    VAR_2.ai_flags = AI_CANONNAME | AI_ADDRCONFIG;

    VAR_2.ai_family = PF_UNSPEC;

    VAR_2.ai_socktype = SOCK_STREAM;



    VAR_5 = qemu_opt_get(VAR_0, "host");

    VAR_6 = qemu_opt_get(VAR_0, "VAR_6");

    if (VAR_5 == NULL || VAR_6 == NULL) {

        error_setg(VAR_1, "host and/or VAR_6 not specified");

        return NULL;

    }



    if (qemu_opt_get_bool(VAR_0, "ipv4", 0)) {

        VAR_2.ai_family = PF_INET;

    }

    if (qemu_opt_get_bool(VAR_0, "ipv6", 0)) {

        VAR_2.ai_family = PF_INET6;

    }



    

    VAR_4 = getaddrinfo(VAR_5, VAR_6, &VAR_2, &VAR_3);

    if (VAR_4 != 0) {

        error_setg(VAR_1, "address resolution failed for %s:%s: %s", VAR_5, VAR_6,

                   gai_strerror(VAR_4));

        return NULL;

    }

    return VAR_3;

}

static struct addrinfo *FUNC_0(QemuOpts *VAR_0, Error **VAR_1)
{ struct addrinfo VAR_2, *VAR_3; int VAR_4; const char *VAR_5; const char *VAR_6; memset(&VAR_2, 0, sizeof(VAR_2)); VAR_2.ai_flags = AI_CANONNAME | AI_ADDRCONFIG; VAR_2.ai_family = PF_UNSPEC; VAR_2.ai_socktype = SOCK_STREAM; VAR_5 = qemu_opt_get(VAR_0, "host"); VAR_6 = qemu_opt_get(VAR_0, "VAR_6"); if (VAR_5 == NULL || VAR_6 == NULL) { error_setg(VAR_1, "host and/or VAR_6 not specified"); return NULL; } if (qemu_opt_get_bool(VAR_0, "ipv4", 0)) { VAR_2.ai_family = PF_INET; } if (qemu_opt_get_bool(VAR_0, "ipv6", 0)) { VAR_2.ai_family = PF_INET6; } VAR_4 = getaddrinfo(VAR_5, VAR_6, &VAR_2, &VAR_3); if (VAR_4 != 0) { error_setg(VAR_1, "address resolution failed for %s:%s: %s", VAR_5, VAR_6,
gai_strerror(VAR_4)); return NULL; } return VAR_3; }