PetScan::extract_int: separate out extraction from llvm::APInt