int inet_listen(const char *str, char *ostr, int olen,

                int socktype, int port_offset, Error **errp)

{

    QemuOpts *opts;

    char *optstr;

    int sock = -1;



    opts = qemu_opts_create(&dummy_opts, NULL, 0);

    if (inet_parse(opts, str) == 0) {

        sock = inet_listen_opts(opts, port_offset, errp);

        if (sock != -1 && ostr) {

            optstr = strchr(str, ',');

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

                snprintf(ostr, olen, "[%s]:%s%s",

                         qemu_opt_get(opts, "host"),

                         qemu_opt_get(opts, "port"),

                         optstr ? optstr : "");

            } else {

                snprintf(ostr, olen, "%s:%s%s",

                         qemu_opt_get(opts, "host"),

                         qemu_opt_get(opts, "port"),

                         optstr ? optstr : "");

            }

        }

    } else {

        error_set(errp, QERR_SOCKET_CREATE_FAILED);

    }

    qemu_opts_del(opts);

    return sock;

}

int inet_listen(const char *str, char *ostr, int olen,

                int socktype, int port_offset, Error **errp)

{

    QemuOpts *opts;

    char *optstr;

    int sock = -1;



    opts = qemu_opts_create(&dummy_opts, NULL, 0);

    if (inet_parse(opts, str) == 0) {

        sock = inet_listen_opts(opts, port_offset, errp);

        if (sock != -1 && ostr) {

            optstr = strchr(str, ',');

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

                snprintf(ostr, olen, "[%s]:%s%s",

                         qemu_opt_get(opts, "host"),

                         qemu_opt_get(opts, "port"),

                         optstr ? optstr : "");

            } else {

                snprintf(ostr, olen, "%s:%s%s",

                         qemu_opt_get(opts, "host"),

                         qemu_opt_get(opts, "port"),

                         optstr ? optstr : "");

            }

        }

    } else {

        error_set(errp, QERR_SOCKET_CREATE_FAILED);

    }

    qemu_opts_del(opts);

    return sock;

}

    opts = qemu_opts_create(&dummy_opts, NULL, 0);     opts = qemu_opts_create(&dummy_opts, NULL, 0);     opts = qemu_opts_create(&dummy_opts, NULL, 0);     opts = qemu_opts_create(&dummy_opts, NULL, 0);
int FUNC_0(const char *VAR_0, char *VAR_1, int VAR_2,

                int VAR_3, int VAR_4, Error **VAR_5)

{

    QemuOpts *opts;

    char *VAR_6;

    int VAR_7 = -1;



    opts = qemu_opts_create(&dummy_opts, NULL, 0);

    if (inet_parse(opts, VAR_0) == 0) {

        VAR_7 = inet_listen_opts(opts, VAR_4, VAR_5);

        if (VAR_7 != -1 && VAR_1) {

            VAR_6 = strchr(VAR_0, ',');

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

                snprintf(VAR_1, VAR_2, "[%s]:%s%s",

                         qemu_opt_get(opts, "host"),

                         qemu_opt_get(opts, "port"),

                         VAR_6 ? VAR_6 : "");

            } else {

                snprintf(VAR_1, VAR_2, "%s:%s%s",

                         qemu_opt_get(opts, "host"),

                         qemu_opt_get(opts, "port"),

                         VAR_6 ? VAR_6 : "");

            }

        }

    } else {

        error_set(VAR_5, QERR_SOCKET_CREATE_FAILED);

    }

    qemu_opts_del(opts);

    return VAR_7;

}

int FUNC_0(const char *VAR_0, char *VAR_1, int VAR_2,
int VAR_3, int VAR_4, Error **VAR_5)
{ QemuOpts *opts; char *VAR_6; int VAR_7 = -1; opts = qemu_opts_create(&dummy_opts, NULL, 0); if (inet_parse(opts, VAR_0) == 0) { VAR_7 = inet_listen_opts(opts, VAR_4, VAR_5); if (VAR_7 != -1 && VAR_1) { VAR_6 = strchr(VAR_0, ','); if (qemu_opt_get_bool(opts, "ipv6", 0)) { snprintf(VAR_1, VAR_2, "[%s]:%s%s",
qemu_opt_get(opts, "host"),
qemu_opt_get(opts, "port"),
VAR_6 ? VAR_6 : ""); } else { snprintf(VAR_1, VAR_2, "%s:%s%s",
qemu_opt_get(opts, "host"),
qemu_opt_get(opts, "port"),
VAR_6 ? VAR_6 : ""); } } } else { error_set(VAR_5, QERR_SOCKET_CREATE_FAILED); } qemu_opts_del(opts); return VAR_7; }