Topological strings and large N phase transitions II: Chiral expansion of q-deformed Yang-Mills theory