static void memory_region_iorange_read(IORange *iorange,

                                       uint64_t offset,

                                       unsigned width,

                                       uint64_t *data)

{

    MemoryRegion *mr = container_of(iorange, MemoryRegion, iorange);



    if (mr->ops->old_portio) {

        const MemoryRegionPortio *mrp = find_portio(mr, offset, width, false);



        *data = ((uint64_t)1 << (width * 8)) - 1;

        if (mrp) {

            *data = mrp->read(mr->opaque, offset - mrp->offset);

        }

        return;

    }

    *data = mr->ops->read(mr->opaque, offset, width);

}

static void memory_region_iorange_read(IORange *iorange,

                                       uint64_t offset,

                                       unsigned width,

                                       uint64_t *data)

{

    MemoryRegion *mr = container_of(iorange, MemoryRegion, iorange);



    if (mr->ops->old_portio) {

        const MemoryRegionPortio *mrp = find_portio(mr, offset, width, false);



        *data = ((uint64_t)1 << (width * 8)) - 1;

        if (mrp) {

            *data = mrp->read(mr->opaque, offset - mrp->offset);

        }

        return;

    }

    *data = mr->ops->read(mr->opaque, offset, width);

}

static void FUNC_0(IORange *VAR_0,

                                       uint64_t VAR_1,

                                       unsigned VAR_2,

                                       uint64_t *VAR_3)

{

    MemoryRegion *mr = container_of(VAR_0, MemoryRegion, VAR_0);



    if (mr->ops->old_portio) {

        const MemoryRegionPortio *VAR_4 = find_portio(mr, VAR_1, VAR_2, false);



        *VAR_3 = ((uint64_t)1 << (VAR_2 * 8)) - 1;

        if (VAR_4) {

            *VAR_3 = VAR_4->read(mr->opaque, VAR_1 - VAR_4->VAR_1);

        }

        return;

    }

    *VAR_3 = mr->ops->read(mr->opaque, VAR_1, VAR_2);

}

static void FUNC_0(IORange *VAR_0,
uint64_t VAR_1,
unsigned VAR_2,
uint64_t *VAR_3)
{ MemoryRegion *mr = container_of(VAR_0, MemoryRegion, VAR_0); if (mr->ops->old_portio) { const MemoryRegionPortio *VAR_4 = find_portio(mr, VAR_1, VAR_2, false); *VAR_3 = ((uint64_t)1 << (VAR_2 * 8)) - 1; if (VAR_4) { *VAR_3 = VAR_4->read(mr->opaque, VAR_1 - VAR_4->VAR_1); } return; } *VAR_3 = mr->ops->read(mr->opaque, VAR_1, VAR_2); }