static int udp_socket_create(UDPContext *s, struct sockaddr_storage *addr,

                             socklen_t *addr_len, const char *localaddr)

{

    int udp_fd = -1;

    struct addrinfo *res0 = NULL, *res = NULL;

    int family = AF_UNSPEC;



    if (((struct sockaddr *) &s->dest_addr)->sa_family)

        family = ((struct sockaddr *) &s->dest_addr)->sa_family;

    res0 = udp_resolve_host(localaddr[0] ? localaddr : NULL, s->local_port,

                            SOCK_DGRAM, family, AI_PASSIVE);

    if (res0 == 0)

        goto fail;

    for (res = res0; res; res=res->ai_next) {

        udp_fd = ff_socket(res->ai_family, SOCK_DGRAM, 0);

        if (udp_fd != -1) break;

        log_net_error(NULL, AV_LOG_ERROR, "socket");

    }



    if (udp_fd < 0)

        goto fail;



    memcpy(addr, res->ai_addr, res->ai_addrlen);

    *addr_len = res->ai_addrlen;



    freeaddrinfo(res0);



    return udp_fd;



 fail:

    if (udp_fd >= 0)

        closesocket(udp_fd);

    if(res0)

        freeaddrinfo(res0);

    return -1;

}

static int udp_socket_create(UDPContext *s, struct sockaddr_storage *addr,

                             socklen_t *addr_len, const char *localaddr)

{

    int udp_fd = -1;

    struct addrinfo *res0 = NULL, *res = NULL;

    int family = AF_UNSPEC;



    if (((struct sockaddr *) &s->dest_addr)->sa_family)

        family = ((struct sockaddr *) &s->dest_addr)->sa_family;

    res0 = udp_resolve_host(localaddr[0] ? localaddr : NULL, s->local_port,

                            SOCK_DGRAM, family, AI_PASSIVE);

    if (res0 == 0)

        goto fail;

    for (res = res0; res; res=res->ai_next) {

        udp_fd = ff_socket(res->ai_family, SOCK_DGRAM, 0);

        if (udp_fd != -1) break;

        log_net_error(NULL, AV_LOG_ERROR, "socket");

    }



    if (udp_fd < 0)

        goto fail;



    memcpy(addr, res->ai_addr, res->ai_addrlen);

    *addr_len = res->ai_addrlen;



    freeaddrinfo(res0);



    return udp_fd;



 fail:

    if (udp_fd >= 0)

        closesocket(udp_fd);

    if(res0)

        freeaddrinfo(res0);

    return -1;

}

    res0 = udp_resolve_host(localaddr[0] ? localaddr : NULL, s->local_port,
static int FUNC_0(UDPContext *VAR_0, struct sockaddr_storage *VAR_1,

                             socklen_t *VAR_2, const char *VAR_3)

{

    int VAR_4 = -1;

    struct addrinfo *VAR_5 = NULL, *VAR_6 = NULL;

    int VAR_7 = AF_UNSPEC;



    if (((struct sockaddr *) &VAR_0->dest_addr)->sa_family)

        VAR_7 = ((struct sockaddr *) &VAR_0->dest_addr)->sa_family;

    VAR_5 = udp_resolve_host(VAR_3[0] ? VAR_3 : NULL, VAR_0->local_port,

                            SOCK_DGRAM, VAR_7, AI_PASSIVE);

    if (VAR_5 == 0)

        goto fail;

    for (VAR_6 = VAR_5; VAR_6; VAR_6=VAR_6->ai_next) {

        VAR_4 = ff_socket(VAR_6->ai_family, SOCK_DGRAM, 0);

        if (VAR_4 != -1) break;

        log_net_error(NULL, AV_LOG_ERROR, "socket");

    }



    if (VAR_4 < 0)

        goto fail;



    memcpy(VAR_1, VAR_6->ai_addr, VAR_6->ai_addrlen);

    *VAR_2 = VAR_6->ai_addrlen;



    freeaddrinfo(VAR_5);



    return VAR_4;



 fail:

    if (VAR_4 >= 0)

        closesocket(VAR_4);

    if(VAR_5)

        freeaddrinfo(VAR_5);

    return -1;

}

static int FUNC_0(UDPContext *VAR_0, struct sockaddr_storage *VAR_1,
socklen_t *VAR_2, const char *VAR_3)
{ int VAR_4 = -1; struct addrinfo *VAR_5 = NULL, *VAR_6 = NULL; int VAR_7 = AF_UNSPEC; if (((struct sockaddr *) &VAR_0->dest_addr)->sa_family)
VAR_7 = ((struct sockaddr *) &VAR_0->dest_addr)->sa_family; VAR_5 = udp_resolve_host(VAR_3[0] ? VAR_3 : NULL, VAR_0->local_port,
SOCK_DGRAM, VAR_7, AI_PASSIVE); if (VAR_5 == 0)
goto fail; for (VAR_6 = VAR_5; VAR_6; VAR_6=VAR_6->ai_next) { VAR_4 = ff_socket(VAR_6->ai_family, SOCK_DGRAM, 0); if (VAR_4 != -1) break; log_net_error(NULL, AV_LOG_ERROR, "socket"); } if (VAR_4 < 0)
goto fail; memcpy(VAR_1, VAR_6->ai_addr, VAR_6->ai_addrlen); *VAR_2 = VAR_6->ai_addrlen; freeaddrinfo(VAR_5); return VAR_4; fail:
if (VAR_4 >= 0)
closesocket(VAR_4); if(VAR_5)
freeaddrinfo(VAR_5); return -1; }