Know this flight very well and do this run for work several times a year, normally I would say go through SFO but with a 5 hour wait and and a dreamliner out of ORD the answer is easy as many above have stated....ORD. The equipment you will get out of SFO and LAX in a word sucks. Plus 5 hours is a bit long even at SFO which has quite a bit of stuff to keep you entertained.