During the electrolysis of molten calcium bromide (CaBr2) and magnesium iodide (MgI2), bromine gas is produced at the anode from the oxidation of bromide ions. The process at the anode is oxidation, as bromide ions lose electrons. In terms of thermodynamic feasibility, the decomposition of calcium bromide is generally considered more spontaneous than that of magnesium iodide. This is due to the lower standard electrode potential of calcium compared to magnesium, making the oxidation of bromide ions more favorable. Overall, electrolysis of CaBr2 is thermodynamically easier to achieve than that of MgI2.