static void qxl_flip(PCIQXLDevice *qxl, QXLRect *rect)

{

    uint8_t *src = qxl->guest_primary.data;

    uint8_t *dst = qxl->guest_primary.flipped;

    int len, i;



    src += (qxl->guest_primary.surface.height - rect->top - 1) *

        qxl->guest_primary.stride;

    dst += rect->top  * qxl->guest_primary.stride;

    src += rect->left * qxl->guest_primary.bytes_pp;

    dst += rect->left * qxl->guest_primary.bytes_pp;

    len  = (rect->right - rect->left) * qxl->guest_primary.bytes_pp;



    for (i = rect->top; i < rect->bottom; i++) {

        memcpy(dst, src, len);

        dst += qxl->guest_primary.stride;

        src -= qxl->guest_primary.stride;

    }

}

static void qxl_flip(PCIQXLDevice *qxl, QXLRect *rect)

{

    uint8_t *src = qxl->guest_primary.data;

    uint8_t *dst = qxl->guest_primary.flipped;

    int len, i;



    src += (qxl->guest_primary.surface.height - rect->top - 1) *

        qxl->guest_primary.stride;

    dst += rect->top  * qxl->guest_primary.stride;

    src += rect->left * qxl->guest_primary.bytes_pp;

    dst += rect->left * qxl->guest_primary.bytes_pp;

    len  = (rect->right - rect->left) * qxl->guest_primary.bytes_pp;



    for (i = rect->top; i < rect->bottom; i++) {

        memcpy(dst, src, len);

        dst += qxl->guest_primary.stride;

        src -= qxl->guest_primary.stride;

    }

}

static void FUNC_0(PCIQXLDevice *VAR_0, QXLRect *VAR_1)

{

    uint8_t *src = VAR_0->guest_primary.data;

    uint8_t *dst = VAR_0->guest_primary.flipped;

    int VAR_2, VAR_3;



    src += (VAR_0->guest_primary.surface.height - VAR_1->top - 1) *

        VAR_0->guest_primary.stride;

    dst += VAR_1->top  * VAR_0->guest_primary.stride;

    src += VAR_1->left * VAR_0->guest_primary.bytes_pp;

    dst += VAR_1->left * VAR_0->guest_primary.bytes_pp;

    VAR_2  = (VAR_1->right - VAR_1->left) * VAR_0->guest_primary.bytes_pp;



    for (VAR_3 = VAR_1->top; VAR_3 < VAR_1->bottom; VAR_3++) {

        memcpy(dst, src, VAR_2);

        dst += VAR_0->guest_primary.stride;

        src -= VAR_0->guest_primary.stride;

    }

}

static void FUNC_0(PCIQXLDevice *VAR_0, QXLRect *VAR_1)
{ uint8_t *src = VAR_0->guest_primary.data; uint8_t *dst = VAR_0->guest_primary.flipped; int VAR_2, VAR_3; src += (VAR_0->guest_primary.surface.height - VAR_1->top - 1) *
VAR_0->guest_primary.stride; dst += VAR_1->top  * VAR_0->guest_primary.stride; src += VAR_1->left * VAR_0->guest_primary.bytes_pp; dst += VAR_1->left * VAR_0->guest_primary.bytes_pp; VAR_2  = (VAR_1->right - VAR_1->left) * VAR_0->guest_primary.bytes_pp; for (VAR_3 = VAR_1->top; VAR_3 < VAR_1->bottom; VAR_3++) { memcpy(dst, src, VAR_2); dst += VAR_0->guest_primary.stride; src -= VAR_0->guest_primary.stride; } }