First-order Lagrangians and the Hamiltonian formalism