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

                              uint32_t color, int *x_ptr, int *y_ptr,

                              int *w_ptr, int *h_ptr)

{

    int cx, cy;



    /* Try to extend the area upwards. */

    for ( cy = *y_ptr - 1;

          cy >= y && check_solid_tile(vs, *x_ptr, cy, *w_ptr, 1, &color, true);

          cy-- );

    *h_ptr += *y_ptr - (cy + 1);

    *y_ptr = cy + 1;



    /* ... downwards. */

    for ( cy = *y_ptr + *h_ptr;

          cy < y + h &&

              check_solid_tile(vs, *x_ptr, cy, *w_ptr, 1, &color, true);

          cy++ );

    *h_ptr += cy - (*y_ptr + *h_ptr);



    /* ... to the left. */

    for ( cx = *x_ptr - 1;

          cx >= x && check_solid_tile(vs, cx, *y_ptr, 1, *h_ptr, &color, true);

          cx-- );

    *w_ptr += *x_ptr - (cx + 1);

    *x_ptr = cx + 1;



    /* ... to the right. */

    for ( cx = *x_ptr + *w_ptr;

          cx < x + w &&

              check_solid_tile(vs, cx, *y_ptr, 1, *h_ptr, &color, true);

          cx++ );

    *w_ptr += cx - (*x_ptr + *w_ptr);

}

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

                              uint32_t color, int *x_ptr, int *y_ptr,

                              int *w_ptr, int *h_ptr)

{

    int cx, cy;



    

    for ( cy = *y_ptr - 1;

          cy >= y && check_solid_tile(vs, *x_ptr, cy, *w_ptr, 1, &color, true);

          cy-- );

    *h_ptr += *y_ptr - (cy + 1);

    *y_ptr = cy + 1;



    

    for ( cy = *y_ptr + *h_ptr;

          cy < y + h &&

              check_solid_tile(vs, *x_ptr, cy, *w_ptr, 1, &color, true);

          cy++ );

    *h_ptr += cy - (*y_ptr + *h_ptr);



    

    for ( cx = *x_ptr - 1;

          cx >= x && check_solid_tile(vs, cx, *y_ptr, 1, *h_ptr, &color, true);

          cx-- );

    *w_ptr += *x_ptr - (cx + 1);

    *x_ptr = cx + 1;



    

    for ( cx = *x_ptr + *w_ptr;

          cx < x + w &&

              check_solid_tile(vs, cx, *y_ptr, 1, *h_ptr, &color, true);

          cx++ );

    *w_ptr += cx - (*x_ptr + *w_ptr);

}

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, int *VAR_9)

{

    int VAR_10, VAR_11;



    

    for ( VAR_11 = *VAR_7 - 1;

          VAR_11 >= VAR_2 && check_solid_tile(VAR_0, *VAR_6, VAR_11, *VAR_8, 1, &VAR_5, true);

          VAR_11-- );

    *VAR_9 += *VAR_7 - (VAR_11 + 1);

    *VAR_7 = VAR_11 + 1;



    

    for ( VAR_11 = *VAR_7 + *VAR_9;

          VAR_11 < VAR_2 + VAR_4 &&

              check_solid_tile(VAR_0, *VAR_6, VAR_11, *VAR_8, 1, &VAR_5, true);

          VAR_11++ );

    *VAR_9 += VAR_11 - (*VAR_7 + *VAR_9);



    

    for ( VAR_10 = *VAR_6 - 1;

          VAR_10 >= VAR_1 && check_solid_tile(VAR_0, VAR_10, *VAR_7, 1, *VAR_9, &VAR_5, true);

          VAR_10-- );

    *VAR_8 += *VAR_6 - (VAR_10 + 1);

    *VAR_6 = VAR_10 + 1;



    

    for ( VAR_10 = *VAR_6 + *VAR_8;

          VAR_10 < VAR_1 + VAR_3 &&

              check_solid_tile(VAR_0, VAR_10, *VAR_7, 1, *VAR_9, &VAR_5, true);

          VAR_10++ );

    *VAR_8 += VAR_10 - (*VAR_6 + *VAR_8);

}

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, int *VAR_9)
{ int VAR_10, VAR_11; for ( VAR_11 = *VAR_7 - 1; VAR_11 >= VAR_2 && check_solid_tile(VAR_0, *VAR_6, VAR_11, *VAR_8, 1, &VAR_5, true); VAR_11-- ); *VAR_9 += *VAR_7 - (VAR_11 + 1); *VAR_7 = VAR_11 + 1; for ( VAR_11 = *VAR_7 + *VAR_9; VAR_11 < VAR_2 + VAR_4 &&
check_solid_tile(VAR_0, *VAR_6, VAR_11, *VAR_8, 1, &VAR_5, true); VAR_11++ ); *VAR_9 += VAR_11 - (*VAR_7 + *VAR_9); for ( VAR_10 = *VAR_6 - 1; VAR_10 >= VAR_1 && check_solid_tile(VAR_0, VAR_10, *VAR_7, 1, *VAR_9, &VAR_5, true); VAR_10-- ); *VAR_8 += *VAR_6 - (VAR_10 + 1); *VAR_6 = VAR_10 + 1; for ( VAR_10 = *VAR_6 + *VAR_8; VAR_10 < VAR_1 + VAR_3 &&
check_solid_tile(VAR_0, VAR_10, *VAR_7, 1, *VAR_9, &VAR_5, true); VAR_10++ ); *VAR_8 += VAR_10 - (*VAR_6 + *VAR_8); }