GM rebounds with first quarterly profit in 3 years