Previous H1B revoked - new employer petition transfer approval pending - Legal stay period ?

I’ve resigned company “X” and joined company “Y” on transfer receipt. My transfer with company “Y” got denied. and next day my company “Y” again applied new petition and it is pending for approval now.

Mean while company “X” revoked my previous H1B.

I want to know for how many days can I legally stay and work for company “Y” in US.