static void rng_egd_chr_read(void *opaque, const uint8_t *buf, int size)

{

    RngEgd *s = RNG_EGD(opaque);

    size_t buf_offset = 0;



    while (size > 0 && s->parent.requests) {

        RngRequest *req = s->parent.requests->data;

        int len = MIN(size, req->size - req->offset);



        memcpy(req->data + req->offset, buf + buf_offset, len);

        buf_offset += len;

        req->offset += len;

        size -= len;



        if (req->offset == req->size) {

            s->parent.requests = g_slist_remove_link(s->parent.requests,

                                                     s->parent.requests);



            req->receive_entropy(req->opaque, req->data, req->size);



            rng_egd_free_request(req);

        }

    }

}

static void rng_egd_chr_read(void *opaque, const uint8_t *buf, int size)

{

    RngEgd *s = RNG_EGD(opaque);

    size_t buf_offset = 0;



    while (size > 0 && s->parent.requests) {

        RngRequest *req = s->parent.requests->data;

        int len = MIN(size, req->size - req->offset);



        memcpy(req->data + req->offset, buf + buf_offset, len);

        buf_offset += len;

        req->offset += len;

        size -= len;



        if (req->offset == req->size) {

            s->parent.requests = g_slist_remove_link(s->parent.requests,

                                                     s->parent.requests);



            req->receive_entropy(req->opaque, req->data, req->size);



            rng_egd_free_request(req);

        }

    }

}

static void FUNC_0(void *VAR_0, const uint8_t *VAR_1, int VAR_2)

{

    RngEgd *s = RNG_EGD(VAR_0);

    size_t buf_offset = 0;



    while (VAR_2 > 0 && s->parent.requests) {

        RngRequest *req = s->parent.requests->data;

        int VAR_3 = MIN(VAR_2, req->VAR_2 - req->offset);



        memcpy(req->data + req->offset, VAR_1 + buf_offset, VAR_3);

        buf_offset += VAR_3;

        req->offset += VAR_3;

        VAR_2 -= VAR_3;



        if (req->offset == req->VAR_2) {

            s->parent.requests = g_slist_remove_link(s->parent.requests,

                                                     s->parent.requests);



            req->receive_entropy(req->VAR_0, req->data, req->VAR_2);



            rng_egd_free_request(req);

        }

    }

}

static void FUNC_0(void *VAR_0, const uint8_t *VAR_1, int VAR_2)
{ RngEgd *s = RNG_EGD(VAR_0); size_t buf_offset = 0; while (VAR_2 > 0 && s->parent.requests) { RngRequest *req = s->parent.requests->data; int VAR_3 = MIN(VAR_2, req->VAR_2 - req->offset); memcpy(req->data + req->offset, VAR_1 + buf_offset, VAR_3); buf_offset += VAR_3; req->offset += VAR_3; VAR_2 -= VAR_3; if (req->offset == req->VAR_2) { s->parent.requests = g_slist_remove_link(s->parent.requests,
s->parent.requests); req->receive_entropy(req->VAR_0, req->data, req->VAR_2); rng_egd_free_request(req); } } }