if (spat instanceof RubyString) {
ByteList spatValue = ((RubyString)spat).value;
int len = spatValue.getRealSize();
Encoding spatEnc = spatValue.getEncoding();
if (len == 0) {
Regex pattern = RubyRegexp.getRegexpFromCache(context.runtime, spatValue, spatEnc, new RegexpOptions());
result = regexSplit19(context, pattern, pattern, limit, lim, i);
} else {
final int c;
byte[]bytes = spatValue.getUnsafeBytes();
int p = spatValue.getBegin();
if (spatEnc.isAsciiCompatible()) {
c = len == 1 ? bytes[p] & 0xff : -1;
} else {
c = len == StringSupport.preciseLength(spatEnc, bytes, p, p + len) ? spatEnc.mbcToCode(bytes, p, p + len) : -1;
}
result = c == ' ' ? awkSplit19(limit, lim, i) : stringSplit19(context, (RubyString)spat, limit, lim, i);
}
} else {
final Regex pattern, prepared;
Ruby runtime = context.runtime;
if (spat instanceof RubyRegexp) {
RubyRegexp regexp = (RubyRegexp)spat;
pattern = regexp.getPattern();