Ana Pazos reported a bug where we were not checking that an APInt would
fit into 64-bits before calling getSExtValue(). This caused asserts when
compiling large constants, such as i128s, as happens when compiling compiler-rt.
This patch adds a testcase and makes the callback less error-prone.