register int x, y, i;
register unsigned int x, y;
PutImagePixels(image, width, height, pixelindex, pixels)    XImage *image;    unsigned int width;    unsigned int height;    unsigned int *pixelindex;    Pixel *pixels;{    register char *src;    register char *dst;    register unsigned int *iptr;    register int x, y, i;    register char *data;    Pixel pixel, px;    int nbytes, depth, ibu, ibpp;    data = image->data;    iptr = pixelindex;    depth = image->depth;    if (depth == 1) {	ibu = image->bitmap_unit;	for (y = 0; y < height; y++)	    for (x = 0; x < width; x++, iptr++) {		pixel = pixels[*iptr];		for (i = 0, px = pixel; i < sizeof(unsigned long);		     i++, px >>= 8)		    ((unsigned char *) &pixel)[i] = px;		src = &data[XYINDEX(x, y, image)];		dst = (char *) &px;		px = 0;		nbytes = ibu >> 3;		for (i = nbytes; --i >= 0;)		    *dst++ = *src++;		XYNORMALIZE(&px, image);		_putbits((char *) &pixel, (x % ibu), 1, (char *) &px);		XYNORMALIZE(&px, image);		src = (char *) &px;		dst = &data[XYINDEX(x, y, image)];		for (i = nbytes; --i >= 0;)		    *dst++ = *src++;	    }    } else {	ibpp = image->bits_per_pixel;	for (y = 0; y < height; y++)	    for (x = 0; x < width; x++, iptr++) {		pixel = pixels[*iptr];		if (depth == 4)		    pixel &= 0xf;		for (i = 0, px = pixel; i < sizeof(unsigned long); i++,		     px >>= 8)		    ((unsigned char *) &pixel)[i] = px;		src = &data[ZINDEX(x, y, image)];		dst = (char *) &px;		px = 0;		nbytes = (ibpp + 7) >> 3;		for (i = nbytes; --i >= 0;)		    *dst++ = *src++;		ZNORMALIZE(&px, image);		_putbits((char *) &pixel, (x * ibpp) & 7, ibpp, (char *) &px);		ZNORMALIZE(&px, image);		src = (char *) &px;		dst = &data[ZINDEX(x, y, image)];		for (i = nbytes; --i >= 0;)		    *dst++ = *src++;	    }    }}