void memory_region_del_eventfd(MemoryRegion *mr,

                               hwaddr addr,

                               unsigned size,

                               bool match_data,

                               uint64_t data,

                               EventNotifier *e)

{

    MemoryRegionIoeventfd mrfd = {

        .addr.start = int128_make64(addr),

        .addr.size = int128_make64(size),

        .match_data = match_data,

        .data = data,

        .e = e,

    };

    unsigned i;



    adjust_endianness(mr, &mrfd.data, size);

    memory_region_transaction_begin();

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

        if (memory_region_ioeventfd_equal(mrfd, mr->ioeventfds[i])) {

            break;

        }

    }

    assert(i != mr->ioeventfd_nb);

    memmove(&mr->ioeventfds[i], &mr->ioeventfds[i+1],

            sizeof(*mr->ioeventfds) * (mr->ioeventfd_nb - (i+1)));

    --mr->ioeventfd_nb;

    mr->ioeventfds = g_realloc(mr->ioeventfds,

                                  sizeof(*mr->ioeventfds)*mr->ioeventfd_nb + 1);

    ioeventfd_update_pending |= mr->enabled;

    memory_region_transaction_commit();

}

void memory_region_del_eventfd(MemoryRegion *mr,

                               hwaddr addr,

                               unsigned size,

                               bool match_data,

                               uint64_t data,

                               EventNotifier *e)

{

    MemoryRegionIoeventfd mrfd = {

        .addr.start = int128_make64(addr),

        .addr.size = int128_make64(size),

        .match_data = match_data,

        .data = data,

        .e = e,

    };

    unsigned i;



    adjust_endianness(mr, &mrfd.data, size);

    memory_region_transaction_begin();

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

        if (memory_region_ioeventfd_equal(mrfd, mr->ioeventfds[i])) {

            break;

        }

    }

    assert(i != mr->ioeventfd_nb);

    memmove(&mr->ioeventfds[i], &mr->ioeventfds[i+1],

            sizeof(*mr->ioeventfds) * (mr->ioeventfd_nb - (i+1)));

    --mr->ioeventfd_nb;

    mr->ioeventfds = g_realloc(mr->ioeventfds,

                                  sizeof(*mr->ioeventfds)*mr->ioeventfd_nb + 1);

    ioeventfd_update_pending |= mr->enabled;

    memory_region_transaction_commit();

}

    adjust_endianness(mr, &mrfd.data, size);     adjust_endianness(mr, &mrfd.data, size);
void FUNC_0(MemoryRegion *VAR_0,

                               hwaddr VAR_1,

                               unsigned VAR_2,

                               bool VAR_3,

                               uint64_t VAR_4,

                               EventNotifier *VAR_5)

{

    MemoryRegionIoeventfd mrfd = {

        .VAR_1.start = int128_make64(VAR_1),

        .VAR_1.VAR_2 = int128_make64(VAR_2),

        .VAR_3 = VAR_3,

        .VAR_4 = VAR_4,

        .VAR_5 = VAR_5,

    };

    unsigned VAR_6;



    adjust_endianness(VAR_0, &mrfd.VAR_4, VAR_2);

    memory_region_transaction_begin();

    for (VAR_6 = 0; VAR_6 < VAR_0->ioeventfd_nb; ++VAR_6) {

        if (memory_region_ioeventfd_equal(mrfd, VAR_0->ioeventfds[VAR_6])) {

            break;

        }

    }

    assert(VAR_6 != VAR_0->ioeventfd_nb);

    memmove(&VAR_0->ioeventfds[VAR_6], &VAR_0->ioeventfds[VAR_6+1],

            sizeof(*VAR_0->ioeventfds) * (VAR_0->ioeventfd_nb - (VAR_6+1)));

    --VAR_0->ioeventfd_nb;

    VAR_0->ioeventfds = g_realloc(VAR_0->ioeventfds,

                                  sizeof(*VAR_0->ioeventfds)*VAR_0->ioeventfd_nb + 1);

    ioeventfd_update_pending |= VAR_0->enabled;

    memory_region_transaction_commit();

}

void FUNC_0(MemoryRegion *VAR_0,
hwaddr VAR_1,
unsigned VAR_2,
bool VAR_3,
uint64_t VAR_4,
EventNotifier *VAR_5)
{ MemoryRegionIoeventfd mrfd = { .VAR_1.start = int128_make64(VAR_1),
.VAR_1.VAR_2 = int128_make64(VAR_2),
.VAR_3 = VAR_3,
.VAR_4 = VAR_4,
.VAR_5 = VAR_5,
}; unsigned VAR_6; adjust_endianness(VAR_0, &mrfd.VAR_4, VAR_2); memory_region_transaction_begin(); for (VAR_6 = 0; VAR_6 < VAR_0->ioeventfd_nb; ++VAR_6) { if (memory_region_ioeventfd_equal(mrfd, VAR_0->ioeventfds[VAR_6])) { break; } } assert(VAR_6 != VAR_0->ioeventfd_nb); memmove(&VAR_0->ioeventfds[VAR_6], &VAR_0->ioeventfds[VAR_6+1],
sizeof(*VAR_0->ioeventfds) * (VAR_0->ioeventfd_nb - (VAR_6+1))); --VAR_0->ioeventfd_nb; VAR_0->ioeventfds = g_realloc(VAR_0->ioeventfds,
sizeof(*VAR_0->ioeventfds)*VAR_0->ioeventfd_nb + 1); ioeventfd_update_pending |= VAR_0->enabled; memory_region_transaction_commit(); }