static int send_rect_simple(VncState *vs, int x, int y, int w, int h)

{

    int max_size, max_width;

    int max_sub_width, max_sub_height;

    int dx, dy;

    int rw, rh;

    int n = 0;



    max_size = tight_conf[vs->tight_compression].max_rect_size;

    max_width = tight_conf[vs->tight_compression].max_rect_width;



    if (w > max_width || w * h > max_size) {

        max_sub_width = (w > max_width) ? max_width : w;

        max_sub_height = max_size / max_sub_width;



        for (dy = 0; dy < h; dy += max_sub_height) {

            for (dx = 0; dx < w; dx += max_width) {

                rw = MIN(max_sub_width, w - dx);

                rh = MIN(max_sub_height, h - dy);

                n += send_sub_rect(vs, x+dx, y+dy, rw, rh);

            }

        }

    } else {

        n += send_sub_rect(vs, x, y, w, h);

    }



    return n;

}

static int send_rect_simple(VncState *vs, int x, int y, int w, int h)

{

    int max_size, max_width;

    int max_sub_width, max_sub_height;

    int dx, dy;

    int rw, rh;

    int n = 0;



    max_size = tight_conf[vs->tight_compression].max_rect_size;

    max_width = tight_conf[vs->tight_compression].max_rect_width;



    if (w > max_width || w * h > max_size) {

        max_sub_width = (w > max_width) ? max_width : w;

        max_sub_height = max_size / max_sub_width;



        for (dy = 0; dy < h; dy += max_sub_height) {

            for (dx = 0; dx < w; dx += max_width) {

                rw = MIN(max_sub_width, w - dx);

                rh = MIN(max_sub_height, h - dy);

                n += send_sub_rect(vs, x+dx, y+dy, rw, rh);

            }

        }

    } else {

        n += send_sub_rect(vs, x, y, w, h);

    }



    return n;

}

static int FUNC_0(VncState *VAR_0, int VAR_1, int VAR_2, int VAR_3, int VAR_4)

{

    int VAR_5, VAR_6;

    int VAR_7, VAR_8;

    int VAR_9, VAR_10;

    int VAR_11, VAR_12;

    int VAR_13 = 0;



    VAR_5 = tight_conf[VAR_0->tight_compression].max_rect_size;

    VAR_6 = tight_conf[VAR_0->tight_compression].max_rect_width;



    if (VAR_3 > VAR_6 || VAR_3 * VAR_4 > VAR_5) {

        VAR_7 = (VAR_3 > VAR_6) ? VAR_6 : VAR_3;

        VAR_8 = VAR_5 / VAR_7;



        for (VAR_10 = 0; VAR_10 < VAR_4; VAR_10 += VAR_8) {

            for (VAR_9 = 0; VAR_9 < VAR_3; VAR_9 += VAR_6) {

                VAR_11 = MIN(VAR_7, VAR_3 - VAR_9);

                VAR_12 = MIN(VAR_8, VAR_4 - VAR_10);

                VAR_13 += send_sub_rect(VAR_0, VAR_1+VAR_9, VAR_2+VAR_10, VAR_11, VAR_12);

            }

        }

    } else {

        VAR_13 += send_sub_rect(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4);

    }



    return VAR_13;

}

static int FUNC_0(VncState *VAR_0, int VAR_1, int VAR_2, int VAR_3, int VAR_4)
{ int VAR_5, VAR_6; int VAR_7, VAR_8; int VAR_9, VAR_10; int VAR_11, VAR_12; int VAR_13 = 0; VAR_5 = tight_conf[VAR_0->tight_compression].max_rect_size; VAR_6 = tight_conf[VAR_0->tight_compression].max_rect_width; if (VAR_3 > VAR_6 || VAR_3 * VAR_4 > VAR_5) { VAR_7 = (VAR_3 > VAR_6) ? VAR_6 : VAR_3; VAR_8 = VAR_5 / VAR_7; for (VAR_10 = 0; VAR_10 < VAR_4; VAR_10 += VAR_8) { for (VAR_9 = 0; VAR_9 < VAR_3; VAR_9 += VAR_6) { VAR_11 = MIN(VAR_7, VAR_3 - VAR_9); VAR_12 = MIN(VAR_8, VAR_4 - VAR_10); VAR_13 += send_sub_rect(VAR_0, VAR_1+VAR_9, VAR_2+VAR_10, VAR_11, VAR_12); } } } else { VAR_13 += send_sub_rect(VAR_0, VAR_1, VAR_2, VAR_3, VAR_4); } return VAR_13; }