1 /* { dg-options "-O3 -floop-nest-optimize" } */
2 
3 typedef unsigned char uint8_t;
4 
border_mirror(uint8_t * outer_img,int w,int h,int rb,int border)5 void border_mirror(uint8_t *outer_img, int w, int h, int rb, int border)
6 {
7   uint8_t *img = outer_img + border * rb + border;
8   int x, y;
9 
10   for (y = -border; y < 0; y++) {
11     for (x = -border; x < 0; x++)
12       img[y*rb + x] = img[(-y)*rb + (-x)];
13 
14     for (x = 0; x < w; x++)
15       img[y*rb + x] = img[(-y)*rb + x];
16   }
17 }
18 
border_mirror_480(uint8_t * outer_img)19 void border_mirror_480(uint8_t *outer_img)
20 {
21   border_mirror(outer_img, 640, 480, 640 + 16*2, 16);
22 }
23