Parse a string into a 32-bit signed integer: skip leading spaces, read an optional sign, consume digits until a non-digit, and clamp to [-2^31, 2^31-1]. Watch the scanner advance character by character.
[-2^31, 2^31-1]