static void tcx_blit_writel(void *opaque, hwaddr addr,

                            uint64_t val, unsigned size)

{

    TCXState *s = opaque;

    uint32_t adsr, len;

    int i;



    if (!(addr & 4)) {

        s->tmpblit = val;

    } else {

        addr = (addr >> 3) & 0xfffff;

        adsr = val & 0xffffff;

        len = ((val >> 24) & 0x1f) + 1;

        if (adsr == 0xffffff) {

            memset(&s->vram[addr], s->tmpblit, len);

            if (s->depth == 24) {

                val = s->tmpblit & 0xffffff;

                val = cpu_to_be32(val);

                for (i = 0; i < len; i++) {

                    s->vram24[addr + i] = val;

                }

            }

        } else {

            memcpy(&s->vram[addr], &s->vram[adsr], len);

            if (s->depth == 24) {

                memcpy(&s->vram24[addr], &s->vram24[adsr], len * 4);

            }

        }

        memory_region_set_dirty(&s->vram_mem, addr, len);

    }

}

static void tcx_blit_writel(void *opaque, hwaddr addr,

                            uint64_t val, unsigned size)

{

    TCXState *s = opaque;

    uint32_t adsr, len;

    int i;



    if (!(addr & 4)) {

        s->tmpblit = val;

    } else {

        addr = (addr >> 3) & 0xfffff;

        adsr = val & 0xffffff;

        len = ((val >> 24) & 0x1f) + 1;

        if (adsr == 0xffffff) {

            memset(&s->vram[addr], s->tmpblit, len);

            if (s->depth == 24) {

                val = s->tmpblit & 0xffffff;

                val = cpu_to_be32(val);

                for (i = 0; i < len; i++) {

                    s->vram24[addr + i] = val;

                }

            }

        } else {

            memcpy(&s->vram[addr], &s->vram[adsr], len);

            if (s->depth == 24) {

                memcpy(&s->vram24[addr], &s->vram24[adsr], len * 4);

            }

        }

        memory_region_set_dirty(&s->vram_mem, addr, len);

    }

}

static void FUNC_0(void *VAR_0, hwaddr VAR_1,

                            uint64_t VAR_2, unsigned VAR_3)

{

    TCXState *s = VAR_0;

    uint32_t adsr, len;

    int VAR_4;



    if (!(VAR_1 & 4)) {

        s->tmpblit = VAR_2;

    } else {

        VAR_1 = (VAR_1 >> 3) & 0xfffff;

        adsr = VAR_2 & 0xffffff;

        len = ((VAR_2 >> 24) & 0x1f) + 1;

        if (adsr == 0xffffff) {

            memset(&s->vram[VAR_1], s->tmpblit, len);

            if (s->depth == 24) {

                VAR_2 = s->tmpblit & 0xffffff;

                VAR_2 = cpu_to_be32(VAR_2);

                for (VAR_4 = 0; VAR_4 < len; VAR_4++) {

                    s->vram24[VAR_1 + VAR_4] = VAR_2;

                }

            }

        } else {

            memcpy(&s->vram[VAR_1], &s->vram[adsr], len);

            if (s->depth == 24) {

                memcpy(&s->vram24[VAR_1], &s->vram24[adsr], len * 4);

            }

        }

        memory_region_set_dirty(&s->vram_mem, VAR_1, len);

    }

}

static void FUNC_0(void *VAR_0, hwaddr VAR_1,
uint64_t VAR_2, unsigned VAR_3)
{ TCXState *s = VAR_0; uint32_t adsr, len; int VAR_4; if (!(VAR_1 & 4)) { s->tmpblit = VAR_2; } else { VAR_1 = (VAR_1 >> 3) & 0xfffff; adsr = VAR_2 & 0xffffff; len = ((VAR_2 >> 24) & 0x1f) + 1; if (adsr == 0xffffff) { memset(&s->vram[VAR_1], s->tmpblit, len); if (s->depth == 24) { VAR_2 = s->tmpblit & 0xffffff; VAR_2 = cpu_to_be32(VAR_2); for (VAR_4 = 0; VAR_4 < len; VAR_4++) { s->vram24[VAR_1 + VAR_4] = VAR_2; } } } else { memcpy(&s->vram[VAR_1], &s->vram[adsr], len); if (s->depth == 24) { memcpy(&s->vram24[VAR_1], &s->vram24[adsr], len * 4); } } memory_region_set_dirty(&s->vram_mem, VAR_1, len); } }