package o; /* renamed from: o.gjG, reason: case insensitive filesystem */ /* loaded from: classes6.dex */ public final class C15176gjG { /* JADX INFO: Access modifiers changed from: package-private */ public static boolean d(CharSequence charSequence, boolean z, int i, CharSequence charSequence2, int i2) { if ((charSequence instanceof String) && (charSequence2 instanceof String)) { return ((String) charSequence).regionMatches(z, i, (String) charSequence2, 0, i2); } int length = charSequence.length(); int length2 = charSequence2.length(); if (i < 0 || i2 < 0 || length - i < i2 || length2 < i2) { return false; } int i3 = 0; while (i2 > 0) { char charAt = charSequence.charAt(i); char charAt2 = charSequence2.charAt(i3); if (charAt != charAt2) { if (!z) { return false; } char upperCase = Character.toUpperCase(charAt); char upperCase2 = Character.toUpperCase(charAt2); if (upperCase != upperCase2 && Character.toLowerCase(upperCase) != Character.toLowerCase(upperCase2)) { return false; } } i++; i2--; i3++; } return true; } }