Proteas all out for 388 to trail Australia by 162