  We present a comprehensive analysis of the optical and X-ray light curves
(LCs) and spectral energy distributions (SEDs) of a large sample of gamma-ray
burst (GRB) afterglows to investigate the relationship between the optical and
X-ray emission after the prompt phase. We collected the optical data from the
literature and determined the shapes of the optical LCs. Then, using previously
presented X-ray data we modeled the optical/X-ray SEDs. We studied the SED
parameter distributions and compared the optical and X-ray LC slopes and
shapes. The optical and X-ray spectra become softer as a function of time while
the gas-to-dust ratios of GRBs are higher than the values calculated for the
Milky Way and the Large and Magellanic Clouds. For 20% of the GRBs the
difference between the optical and X-ray slopes is consistent with 0 or 1=4
within the uncertainties (we did it not consider the steep decay phase), while
in the remaining 80% the optical and X-ray afterglows show significantly
different temporal behaviors. Interestingly, we find an indication that the
onset of the forward shock in the optical LCs (initial peaks or shallow phases)
could be linked to the presence of the X-ray flares. Indeed, when X-ray flares
are present during the steep decay, the optical LC initial peak or end plateau
occurs during the steep decay; if instead the X-ray flares are absent or occur
during the plateau, the optical initial peak or end plateau takes place during
the X-ray plateau. The forward-shock model cannot explain all features of the
optical (e.g. bumps, late re-brightenings) and X-ray (e.g. flares, plateaus)
LCs. However, the synchrotron model is a viable mechanism for GRBs at late
times. In particular, we found a relationship between the presence of the X-ray
flares and the shape of the optical LC that indicates a link between the prompt
emission and the optical afterglow.
