Origin of organic matter in early solar system—I. Hydrocarbons