On the microscopic mechanism of carbon gasification: a theoretical study