In the recent version of the iCub humanoid robot of the Fondazione Istituto Italiano di Tecnologia (IIT), Series Elastic Actuators (SEA) have been introduced in the knee and ankle pitch joints. As a first step of motion generation for the iCub we analyze the squat motion by means of model based optimal control. The model of the robot has been reduced to 3 DOF on the sagittal plane. The full dynamics of the robot including the elasticity is taken into account. Motions have been generated using different sets of objective functions, such as minimization of joint torques, joint accelerations, mechanical work, squat range. The results have been tested on the iCub of Heidelberg University (HeiCub), a reduced version of the standard iCub without head and arms, with 21 DOF, of which 15 actuated DOF.