Inspired by the efficient method of locomotion of the rattlesnake Crotalus cerastes, the objective of this work is automatic design through genetic programming (GP) of the fastest possible (sidewinding) locomotion of simulated limbless, wheelless snake-like robot (Snakebot). The realism of simulation is ensured by employing the Open Dynamics Engine (ODE), which facilitates implementation of all physical forces, resulting from the actuators, joints constrains, frictions, gravity, and collisions. Reduction of the search space of the GP is achieved by representation of Snakebot as a system comprising identical morphological segments and by automatic definition of code fragments, shared among (and expressing the correlation between) the evolved dynamics of the vertical and horizontal turning angles of the actuators of Snakebot. Empirically obtained results demonstrate the emergence of sidewinding locomotion from relatively simple motion patterns of morphological segments. Robustness of the sidewinding Snakebot, which is considered to be the ability to retain its velocity when situated in an unanticipated environment, is illustrated by the ease with which Snakebot overcomes various types of obstacles such as a pile of or burial under boxes, rugged terrain, and small walls. The ability of Snakebot to adapt to partial damage by gradually improving its velocity characteristics is discussed. Discovering compensatory locomotion traits, Snakebot recovers completely from single damage and recovers a major extent of its original velocity when more significant damage is inflicted. Exploring the opportunity for automatic design and adaptation of a simulated artifact, this work could be considered as a step toward building real Snakebots, which are able to perform robustly in difficult environments.