If you really want to explore the opportunity with company B, I suggest speaking with an immigration lawyer.
An L-1B visa is for intracompany transferees, and you can't simply transfer it to Company B unless you had worked for an overseas company related to Company B for one year out of the three before you came to the U.S. (if this isn't the situation, you aren't an intracompany transferee and don't qualify for an L-1).
Assuming this is not the case, you would need some other visa type - and this could be problematic. H-1Bs are generally unavailable in most cases even assuming you and the Company B position qualify (there are exceptions which would need to be explored), and while there are a few other visas which might permit employment, only an examination of your circumstances would determine of you qualify for any of them.
Only once an immigration strategy has been established for you to accept the Company B job could we start to figure out timelines and the process involved.