static void find_best_solid_area(VncState *vs, int x, int y, int w, int h,

                                 uint32_t color, int *w_ptr, int *h_ptr)

{

    int dx, dy, dw, dh;

    int w_prev;

    int w_best = 0, h_best = 0;



    w_prev = w;



    for (dy = y; dy < y + h; dy += VNC_TIGHT_MAX_SPLIT_TILE_SIZE) {



        dh = MIN(VNC_TIGHT_MAX_SPLIT_TILE_SIZE, y + h - dy);

        dw = MIN(VNC_TIGHT_MAX_SPLIT_TILE_SIZE, w_prev);



        if (!check_solid_tile(vs, x, dy, dw, dh, &color, true)) {

            break;

        }



        for (dx = x + dw; dx < x + w_prev;) {

            dw = MIN(VNC_TIGHT_MAX_SPLIT_TILE_SIZE, x + w_prev - dx);



            if (!check_solid_tile(vs, dx, dy, dw, dh, &color, true)) {

                break;

            }

            dx += dw;

        }



        w_prev = dx - x;

        if (w_prev * (dy + dh - y) > w_best * h_best) {

            w_best = w_prev;

            h_best = dy + dh - y;

        }

    }



    *w_ptr = w_best;

    *h_ptr = h_best;

}

static void find_best_solid_area(VncState *vs, int x, int y, int w, int h,

                                 uint32_t color, int *w_ptr, int *h_ptr)

{

    int dx, dy, dw, dh;

    int w_prev;

    int w_best = 0, h_best = 0;



    w_prev = w;



    for (dy = y; dy < y + h; dy += VNC_TIGHT_MAX_SPLIT_TILE_SIZE) {



        dh = MIN(VNC_TIGHT_MAX_SPLIT_TILE_SIZE, y + h - dy);

        dw = MIN(VNC_TIGHT_MAX_SPLIT_TILE_SIZE, w_prev);



        if (!check_solid_tile(vs, x, dy, dw, dh, &color, true)) {

            break;

        }



        for (dx = x + dw; dx < x + w_prev;) {

            dw = MIN(VNC_TIGHT_MAX_SPLIT_TILE_SIZE, x + w_prev - dx);



            if (!check_solid_tile(vs, dx, dy, dw, dh, &color, true)) {

                break;

            }

            dx += dw;

        }



        w_prev = dx - x;

        if (w_prev * (dy + dh - y) > w_best * h_best) {

            w_best = w_prev;

            h_best = dy + dh - y;

        }

    }



    *w_ptr = w_best;

    *h_ptr = h_best;

}

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

                                 uint32_t VAR_5, int *VAR_6, int *VAR_7)

{

    int VAR_8, VAR_9, VAR_10, VAR_11;

    int VAR_12;

    int VAR_13 = 0, VAR_14 = 0;



    VAR_12 = VAR_3;



    for (VAR_9 = VAR_2; VAR_9 < VAR_2 + VAR_4; VAR_9 += VNC_TIGHT_MAX_SPLIT_TILE_SIZE) {



        VAR_11 = MIN(VNC_TIGHT_MAX_SPLIT_TILE_SIZE, VAR_2 + VAR_4 - VAR_9);

        VAR_10 = MIN(VNC_TIGHT_MAX_SPLIT_TILE_SIZE, VAR_12);



        if (!check_solid_tile(VAR_0, VAR_1, VAR_9, VAR_10, VAR_11, &VAR_5, true)) {

            break;

        }



        for (VAR_8 = VAR_1 + VAR_10; VAR_8 < VAR_1 + VAR_12;) {

            VAR_10 = MIN(VNC_TIGHT_MAX_SPLIT_TILE_SIZE, VAR_1 + VAR_12 - VAR_8);



            if (!check_solid_tile(VAR_0, VAR_8, VAR_9, VAR_10, VAR_11, &VAR_5, true)) {

                break;

            }

            VAR_8 += VAR_10;

        }



        VAR_12 = VAR_8 - VAR_1;

        if (VAR_12 * (VAR_9 + VAR_11 - VAR_2) > VAR_13 * VAR_14) {

            VAR_13 = VAR_12;

            VAR_14 = VAR_9 + VAR_11 - VAR_2;

        }

    }



    *VAR_6 = VAR_13;

    *VAR_7 = VAR_14;

}

static void FUNC_0(VncState *VAR_0, int VAR_1, int VAR_2, int VAR_3, int VAR_4,
uint32_t VAR_5, int *VAR_6, int *VAR_7)
{ int VAR_8, VAR_9, VAR_10, VAR_11; int VAR_12; int VAR_13 = 0, VAR_14 = 0; VAR_12 = VAR_3; for (VAR_9 = VAR_2; VAR_9 < VAR_2 + VAR_4; VAR_9 += VNC_TIGHT_MAX_SPLIT_TILE_SIZE) { VAR_11 = MIN(VNC_TIGHT_MAX_SPLIT_TILE_SIZE, VAR_2 + VAR_4 - VAR_9); VAR_10 = MIN(VNC_TIGHT_MAX_SPLIT_TILE_SIZE, VAR_12); if (!check_solid_tile(VAR_0, VAR_1, VAR_9, VAR_10, VAR_11, &VAR_5, true)) { break; } for (VAR_8 = VAR_1 + VAR_10; VAR_8 < VAR_1 + VAR_12;) { VAR_10 = MIN(VNC_TIGHT_MAX_SPLIT_TILE_SIZE, VAR_1 + VAR_12 - VAR_8); if (!check_solid_tile(VAR_0, VAR_8, VAR_9, VAR_10, VAR_11, &VAR_5, true)) { break; } VAR_8 += VAR_10; } VAR_12 = VAR_8 - VAR_1; if (VAR_12 * (VAR_9 + VAR_11 - VAR_2) > VAR_13 * VAR_14) { VAR_13 = VAR_12; VAR_14 = VAR_9 + VAR_11 - VAR_2; } } *VAR_6 = VAR_13; *VAR_7 = VAR_14; }