static int check_bind(struct sockaddr *sa, socklen_t salen, bool *has_proto)

{

    int fd;



    fd = socket(sa->sa_family, SOCK_STREAM, 0);

    if (fd < 0) {

        return -1;

    }



    if (bind(fd, sa, salen) < 0) {

        close(fd);

        if (errno == EADDRNOTAVAIL) {

            *has_proto = false;

            return 0;

        }

        return -1;

    }



    close(fd);

    *has_proto = true;

    return 0;

}

static int check_bind(struct sockaddr *sa, socklen_t salen, bool *has_proto)

{

    int fd;



    fd = socket(sa->sa_family, SOCK_STREAM, 0);

    if (fd < 0) {

        return -1;

    }



    if (bind(fd, sa, salen) < 0) {

        close(fd);

        if (errno == EADDRNOTAVAIL) {

            *has_proto = false;

            return 0;

        }

        return -1;

    }



    close(fd);

    *has_proto = true;

    return 0;

}

static int check_bind(struct sockaddr *sa, socklen_t salen, bool *has_proto)     int fd;     fd = socket(sa->sa_family, SOCK_STREAM, 0);         return -1;     if (bind(fd, sa, salen) < 0) {         close(fd);             return 0;         return -1;     close(fd);     return 0;
static int FUNC_0(struct sockaddr *VAR_0, socklen_t VAR_1, bool *VAR_2)

{

    int VAR_3;



    VAR_3 = socket(VAR_0->sa_family, SOCK_STREAM, 0);

    if (VAR_3 < 0) {

        return -1;

    }



    if (bind(VAR_3, VAR_0, VAR_1) < 0) {

        close(VAR_3);

        if (errno == EADDRNOTAVAIL) {

            *VAR_2 = false;

            return 0;

        }

        return -1;

    }



    close(VAR_3);

    *VAR_2 = true;

    return 0;

}

static int FUNC_0(struct sockaddr *VAR_0, socklen_t VAR_1, bool *VAR_2)
{ int VAR_3; VAR_3 = socket(VAR_0->sa_family, SOCK_STREAM, 0); if (VAR_3 < 0) { return -1; } if (bind(VAR_3, VAR_0, VAR_1) < 0) { close(VAR_3); if (errno == EADDRNOTAVAIL) { *VAR_2 = false; return 0; } return -1; } close(VAR_3); *VAR_2 = true; return 0; }