connect_to_qemu(

    const char *host,

    const char *port

) {

    struct addrinfo hints;

    struct addrinfo *server;

    int ret, sock;



    sock = qemu_socket(AF_INET, SOCK_STREAM, 0);

    if (sock < 0) {

        /* Error */

        fprintf(stderr, "Error opening socket!\n");

        return -1;

    }



    memset(&hints, 0, sizeof(struct addrinfo));

    hints.ai_family = AF_UNSPEC;

    hints.ai_socktype = SOCK_STREAM;

    hints.ai_flags = 0;

    hints.ai_protocol = 0;          /* Any protocol */



    ret = getaddrinfo(host, port, &hints, &server);



    if (ret != 0) {

        /* Error */

        fprintf(stderr, "getaddrinfo failed\n");

        return -1;

    }



    if (connect(sock, server->ai_addr, server->ai_addrlen) < 0) {

        /* Error */

        fprintf(stderr, "Could not connect\n");

        return -1;

    }

    if (verbose) {

        printf("Connected (sizeof Header=%zd)!\n", sizeof(VSCMsgHeader));

    }

    return sock;

}

connect_to_qemu(

    const char *host,

    const char *port

) {

    struct addrinfo hints;

    struct addrinfo *server;

    int ret, sock;



    sock = qemu_socket(AF_INET, SOCK_STREAM, 0);

    if (sock < 0) {

        

        fprintf(stderr, "Error opening socket!\n");

        return -1;

    }



    memset(&hints, 0, sizeof(struct addrinfo));

    hints.ai_family = AF_UNSPEC;

    hints.ai_socktype = SOCK_STREAM;

    hints.ai_flags = 0;

    hints.ai_protocol = 0;          



    ret = getaddrinfo(host, port, &hints, &server);



    if (ret != 0) {

        

        fprintf(stderr, "getaddrinfo failed\n");

        return -1;

    }



    if (connect(sock, server->ai_addr, server->ai_addrlen) < 0) {

        

        fprintf(stderr, "Could not connect\n");

        return -1;

    }

    if (verbose) {

        printf("Connected (sizeof Header=%zd)!\n", sizeof(VSCMsgHeader));

    }

    return sock;

}

        return -1;         return -1;
FUNC_0(

    const char *VAR_0,

    const char *VAR_1

) {

    struct addrinfo VAR_2;

    struct addrinfo *VAR_3;

    int VAR_4, VAR_5;



    VAR_5 = qemu_socket(AF_INET, SOCK_STREAM, 0);

    if (VAR_5 < 0) {

        

        fprintf(stderr, "Error opening socket!\n");

        return -1;

    }



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

    VAR_2.ai_family = AF_UNSPEC;

    VAR_2.ai_socktype = SOCK_STREAM;

    VAR_2.ai_flags = 0;

    VAR_2.ai_protocol = 0;          



    VAR_4 = getaddrinfo(VAR_0, VAR_1, &VAR_2, &VAR_3);



    if (VAR_4 != 0) {

        

        fprintf(stderr, "getaddrinfo failed\n");

        return -1;

    }



    if (connect(VAR_5, VAR_3->ai_addr, VAR_3->ai_addrlen) < 0) {

        

        fprintf(stderr, "Could not connect\n");

        return -1;

    }

    if (verbose) {

        printf("Connected (sizeof Header=%zd)!\n", sizeof(VSCMsgHeader));

    }

    return VAR_5;

}

FUNC_0(
const char *VAR_0,
const char *VAR_1
) { struct addrinfo VAR_2; struct addrinfo *VAR_3; int VAR_4, VAR_5; VAR_5 = qemu_socket(AF_INET, SOCK_STREAM, 0); if (VAR_5 < 0) { fprintf(stderr, "Error opening socket!\n"); return -1; } memset(&VAR_2, 0, sizeof(struct addrinfo)); VAR_2.ai_family = AF_UNSPEC; VAR_2.ai_socktype = SOCK_STREAM; VAR_2.ai_flags = 0; VAR_2.ai_protocol = 0; VAR_4 = getaddrinfo(VAR_0, VAR_1, &VAR_2, &VAR_3); if (VAR_4 != 0) { fprintf(stderr, "getaddrinfo failed\n"); return -1; } if (connect(VAR_5, VAR_3->ai_addr, VAR_3->ai_addrlen) < 0) { fprintf(stderr, "Could not connect\n"); return -1; } if (verbose) { printf("Connected (sizeof Header=%zd)!\n", sizeof(VSCMsgHeader)); } return VAR_5; }