Treatment of ethyl cyanoacetate derivative (I) with cyanoacetamide (II) in EtOH in the presence of NaOEt provides dicyano derivative (III), which is then converted into diimide (IV) by treatment with refluxing sulfuric acid. Alternatively, (IV) can also be obtained by reaction between cyclopentanone (V), cyanoacetamide (II) and piperidine by means of KOH or NaOH in H2O (or H2O/EtOH) to provide mononitrile derivative (VI), which is then refluxed with H2SO4. Double N-alkylation of compound (IV) with chloride (VII) by heating with NaH or alkaline carbonate in DMF yields dialkylated compound (VIII), which is reduced with LiAlH4 or Red-Al in refluxing THF/toluene to furnish the free base (IX). Finally, (IX) is converted into the desired dihydrochloride by treatment with HCl in isopropanol.