static void address_space_update_ioeventfds(AddressSpace *as)

{

    FlatView *view;

    FlatRange *fr;

    unsigned ioeventfd_nb = 0;

    MemoryRegionIoeventfd *ioeventfds = NULL;

    AddrRange tmp;

    unsigned i;



    view = as->current_map;

    FOR_EACH_FLAT_RANGE(fr, view) {

        for (i = 0; i < fr->mr->ioeventfd_nb; ++i) {

            tmp = addrrange_shift(fr->mr->ioeventfds[i].addr,

                                  int128_sub(fr->addr.start,

                                             int128_make64(fr->offset_in_region)));

            if (addrrange_intersects(fr->addr, tmp)) {

                ++ioeventfd_nb;

                ioeventfds = g_realloc(ioeventfds,

                                          ioeventfd_nb * sizeof(*ioeventfds));

                ioeventfds[ioeventfd_nb-1] = fr->mr->ioeventfds[i];

                ioeventfds[ioeventfd_nb-1].addr = tmp;

            }

        }

    }



    address_space_add_del_ioeventfds(as, ioeventfds, ioeventfd_nb,

                                     as->ioeventfds, as->ioeventfd_nb);



    g_free(as->ioeventfds);

    as->ioeventfds = ioeventfds;

    as->ioeventfd_nb = ioeventfd_nb;

}

static void address_space_update_ioeventfds(AddressSpace *as)

{

    FlatView *view;

    FlatRange *fr;

    unsigned ioeventfd_nb = 0;

    MemoryRegionIoeventfd *ioeventfds = NULL;

    AddrRange tmp;

    unsigned i;



    view = as->current_map;

    FOR_EACH_FLAT_RANGE(fr, view) {

        for (i = 0; i < fr->mr->ioeventfd_nb; ++i) {

            tmp = addrrange_shift(fr->mr->ioeventfds[i].addr,

                                  int128_sub(fr->addr.start,

                                             int128_make64(fr->offset_in_region)));

            if (addrrange_intersects(fr->addr, tmp)) {

                ++ioeventfd_nb;

                ioeventfds = g_realloc(ioeventfds,

                                          ioeventfd_nb * sizeof(*ioeventfds));

                ioeventfds[ioeventfd_nb-1] = fr->mr->ioeventfds[i];

                ioeventfds[ioeventfd_nb-1].addr = tmp;

            }

        }

    }



    address_space_add_del_ioeventfds(as, ioeventfds, ioeventfd_nb,

                                     as->ioeventfds, as->ioeventfd_nb);



    g_free(as->ioeventfds);

    as->ioeventfds = ioeventfds;

    as->ioeventfd_nb = ioeventfd_nb;

}

static void FUNC_0(AddressSpace *VAR_0)

{

    FlatView *view;

    FlatRange *fr;

    unsigned VAR_1 = 0;

    MemoryRegionIoeventfd *ioeventfds = NULL;

    AddrRange tmp;

    unsigned VAR_2;



    view = VAR_0->current_map;

    FOR_EACH_FLAT_RANGE(fr, view) {

        for (VAR_2 = 0; VAR_2 < fr->mr->VAR_1; ++VAR_2) {

            tmp = addrrange_shift(fr->mr->ioeventfds[VAR_2].addr,

                                  int128_sub(fr->addr.start,

                                             int128_make64(fr->offset_in_region)));

            if (addrrange_intersects(fr->addr, tmp)) {

                ++VAR_1;

                ioeventfds = g_realloc(ioeventfds,

                                          VAR_1 * sizeof(*ioeventfds));

                ioeventfds[VAR_1-1] = fr->mr->ioeventfds[VAR_2];

                ioeventfds[VAR_1-1].addr = tmp;

            }

        }

    }



    address_space_add_del_ioeventfds(VAR_0, ioeventfds, VAR_1,

                                     VAR_0->ioeventfds, VAR_0->VAR_1);



    g_free(VAR_0->ioeventfds);

    VAR_0->ioeventfds = ioeventfds;

    VAR_0->VAR_1 = VAR_1;

}

static void FUNC_0(AddressSpace *VAR_0)
{ FlatView *view; FlatRange *fr; unsigned VAR_1 = 0; MemoryRegionIoeventfd *ioeventfds = NULL; AddrRange tmp; unsigned VAR_2; view = VAR_0->current_map; FOR_EACH_FLAT_RANGE(fr, view) { for (VAR_2 = 0; VAR_2 < fr->mr->VAR_1; ++VAR_2) { tmp = addrrange_shift(fr->mr->ioeventfds[VAR_2].addr,
int128_sub(fr->addr.start,
int128_make64(fr->offset_in_region))); if (addrrange_intersects(fr->addr, tmp)) { ++VAR_1; ioeventfds = g_realloc(ioeventfds,
VAR_1 * sizeof(*ioeventfds)); ioeventfds[VAR_1-1] = fr->mr->ioeventfds[VAR_2]; ioeventfds[VAR_1-1].addr = tmp; } } } address_space_add_del_ioeventfds(VAR_0, ioeventfds, VAR_1,
VAR_0->ioeventfds, VAR_0->VAR_1); g_free(VAR_0->ioeventfds); VAR_0->ioeventfds = ioeventfds; VAR_0->VAR_1 = VAR_1; }