Theory of X-ray diffraction on a lateral crystal with elastically bent lattice planes