static void tight_pack24(VncState *vs, uint8_t *buf, size_t count, size_t *ret)

{

    uint32_t *buf32;

    uint32_t pix;

    int rshift, gshift, bshift;



    buf32 = (uint32_t *)buf;



    if ((vs->clientds.flags & QEMU_BIG_ENDIAN_FLAG) ==

        (vs->ds->surface->flags & QEMU_BIG_ENDIAN_FLAG)) {

        rshift = vs->clientds.pf.rshift;

        gshift = vs->clientds.pf.gshift;

        bshift = vs->clientds.pf.bshift;

    } else {

        rshift = 24 - vs->clientds.pf.rshift;

        gshift = 24 - vs->clientds.pf.gshift;

        bshift = 24 - vs->clientds.pf.bshift;

    }



    if (ret) {

        *ret = count * 3;

    }



    while (count--) {

        pix = *buf32++;

        *buf++ = (char)(pix >> rshift);

        *buf++ = (char)(pix >> gshift);

        *buf++ = (char)(pix >> bshift);

    }

}

static void tight_pack24(VncState *vs, uint8_t *buf, size_t count, size_t *ret)

{

    uint32_t *buf32;

    uint32_t pix;

    int rshift, gshift, bshift;



    buf32 = (uint32_t *)buf;



    if ((vs->clientds.flags & QEMU_BIG_ENDIAN_FLAG) ==

        (vs->ds->surface->flags & QEMU_BIG_ENDIAN_FLAG)) {

        rshift = vs->clientds.pf.rshift;

        gshift = vs->clientds.pf.gshift;

        bshift = vs->clientds.pf.bshift;

    } else {

        rshift = 24 - vs->clientds.pf.rshift;

        gshift = 24 - vs->clientds.pf.gshift;

        bshift = 24 - vs->clientds.pf.bshift;

    }



    if (ret) {

        *ret = count * 3;

    }



    while (count--) {

        pix = *buf32++;

        *buf++ = (char)(pix >> rshift);

        *buf++ = (char)(pix >> gshift);

        *buf++ = (char)(pix >> bshift);

    }

}

static void FUNC_0(VncState *VAR_0, uint8_t *VAR_1, size_t VAR_2, size_t *VAR_3)

{

    uint32_t *buf32;

    uint32_t pix;

    int VAR_4, VAR_5, VAR_6;



    buf32 = (uint32_t *)VAR_1;



    if ((VAR_0->clientds.flags & QEMU_BIG_ENDIAN_FLAG) ==

        (VAR_0->ds->surface->flags & QEMU_BIG_ENDIAN_FLAG)) {

        VAR_4 = VAR_0->clientds.pf.VAR_4;

        VAR_5 = VAR_0->clientds.pf.VAR_5;

        VAR_6 = VAR_0->clientds.pf.VAR_6;

    } else {

        VAR_4 = 24 - VAR_0->clientds.pf.VAR_4;

        VAR_5 = 24 - VAR_0->clientds.pf.VAR_5;

        VAR_6 = 24 - VAR_0->clientds.pf.VAR_6;

    }



    if (VAR_3) {

        *VAR_3 = VAR_2 * 3;

    }



    while (VAR_2--) {

        pix = *buf32++;

        *VAR_1++ = (char)(pix >> VAR_4);

        *VAR_1++ = (char)(pix >> VAR_5);

        *VAR_1++ = (char)(pix >> VAR_6);

    }

}

static void FUNC_0(VncState *VAR_0, uint8_t *VAR_1, size_t VAR_2, size_t *VAR_3)
{ uint32_t *buf32; uint32_t pix; int VAR_4, VAR_5, VAR_6; buf32 = (uint32_t *)VAR_1; if ((VAR_0->clientds.flags & QEMU_BIG_ENDIAN_FLAG) ==
(VAR_0->ds->surface->flags & QEMU_BIG_ENDIAN_FLAG)) { VAR_4 = VAR_0->clientds.pf.VAR_4; VAR_5 = VAR_0->clientds.pf.VAR_5; VAR_6 = VAR_0->clientds.pf.VAR_6; } else { VAR_4 = 24 - VAR_0->clientds.pf.VAR_4; VAR_5 = 24 - VAR_0->clientds.pf.VAR_5; VAR_6 = 24 - VAR_0->clientds.pf.VAR_6; } if (VAR_3) { *VAR_3 = VAR_2 * 3; } while (VAR_2--) { pix = *buf32++; *VAR_1++ = (char)(pix >> VAR_4); *VAR_1++ = (char)(pix >> VAR_5); *VAR_1++ = (char)(pix >> VAR_6); } }