static int qemu_event_init(void)

{

    int err;

    int fds[2];



    err = qemu_eventfd(fds);

    if (err == -1) {

        return -errno;

    }

    err = fcntl_setfl(fds[0], O_NONBLOCK);

    if (err < 0) {

        goto fail;

    }

    err = fcntl_setfl(fds[1], O_NONBLOCK);

    if (err < 0) {

        goto fail;

    }

    qemu_set_fd_handler2(fds[0], NULL, qemu_event_read, NULL,

                         (void *)(intptr_t)fds[0]);



    io_thread_fd = fds[1];

    return 0;



fail:

    close(fds[0]);

    close(fds[1]);

    return err;

}

static int qemu_event_init(void)

{

    int err;

    int fds[2];



    err = qemu_eventfd(fds);

    if (err == -1) {

        return -errno;

    }

    err = fcntl_setfl(fds[0], O_NONBLOCK);

    if (err < 0) {

        goto fail;

    }

    err = fcntl_setfl(fds[1], O_NONBLOCK);

    if (err < 0) {

        goto fail;

    }

    qemu_set_fd_handler2(fds[0], NULL, qemu_event_read, NULL,

                         (void *)(intptr_t)fds[0]);



    io_thread_fd = fds[1];

    return 0;



fail:

    close(fds[0]);

    close(fds[1]);

    return err;

}

static int FUNC_0(void)

{

    int VAR_0;

    int VAR_1[2];



    VAR_0 = qemu_eventfd(VAR_1);

    if (VAR_0 == -1) {

        return -errno;

    }

    VAR_0 = fcntl_setfl(VAR_1[0], O_NONBLOCK);

    if (VAR_0 < 0) {

        goto fail;

    }

    VAR_0 = fcntl_setfl(VAR_1[1], O_NONBLOCK);

    if (VAR_0 < 0) {

        goto fail;

    }

    qemu_set_fd_handler2(VAR_1[0], NULL, qemu_event_read, NULL,

                         (void *)(intptr_t)VAR_1[0]);



    io_thread_fd = VAR_1[1];

    return 0;



fail:

    close(VAR_1[0]);

    close(VAR_1[1]);

    return VAR_0;

}

static int FUNC_0(void)
{ int VAR_0; int VAR_1[2]; VAR_0 = qemu_eventfd(VAR_1); if (VAR_0 == -1) { return -errno; } VAR_0 = fcntl_setfl(VAR_1[0], O_NONBLOCK); if (VAR_0 < 0) { goto fail; } VAR_0 = fcntl_setfl(VAR_1[1], O_NONBLOCK); if (VAR_0 < 0) { goto fail; } qemu_set_fd_handler2(VAR_1[0], NULL, qemu_event_read, NULL,
(void *)(intptr_t)VAR_1[0]); io_thread_fd = VAR_1[1]; return 0; fail:
close(VAR_1[0]); close(VAR_1[1]); return VAR_0; }