My understanding is that gasp using here mostly expressed an emotional feeling of the genie in surprise mixed with a desire of one thousand years locked in the bottle