package f.e0;

/* JADX INFO: Access modifiers changed from: package-private */
/* JADX INFO: compiled from: StringsJVM.kt */
/* JADX INFO: loaded from: classes.dex */
public class s extends r {
    public static boolean d(String str, String str2, boolean z) {
        return str == null ? str2 == null : !z ? str.equals(str2) : str.equalsIgnoreCase(str2);
    }

    /* JADX WARN: Removed duplicated region for block: B:21:? A[RETURN, SYNTHETIC] */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public static boolean e(java.lang.CharSequence r4) {
        /*
            java.lang.String r0 = "<this>"
            f.z.d.k.e(r4, r0)
            int r0 = r4.length()
            r1 = 0
            r2 = 1
            if (r0 == 0) goto L3e
            f.b0.h r0 = f.e0.t.o(r4)
            boolean r3 = r0 instanceof java.util.Collection
            if (r3 == 0) goto L20
            r3 = r0
            java.util.Collection r3 = (java.util.Collection) r3
            boolean r3 = r3.isEmpty()
            if (r3 == 0) goto L20
        L1e:
            r4 = r2
            goto L3c
        L20:
            java.util.Iterator r0 = r0.iterator()
        L24:
            boolean r3 = r0.hasNext()
            if (r3 == 0) goto L1e
            r3 = r0
            f.u.x r3 = (f.u.x) r3
            int r3 = r3.a()
            char r3 = r4.charAt(r3)
            boolean r3 = f.e0.b.c(r3)
            if (r3 != 0) goto L24
            r4 = r1
        L3c:
            if (r4 == 0) goto L3f
        L3e:
            r1 = r2
        L3f:
            return r1
        */
        throw new UnsupportedOperationException("Method not decompiled: f.e0.s.e(java.lang.CharSequence):boolean");
    }

    public static final boolean f(String str, int i2, String str2, int i3, int i4, boolean z) {
        f.z.d.k.e(str, "<this>");
        f.z.d.k.e(str2, "other");
        return !z ? str.regionMatches(i2, str2, i3, i4) : str.regionMatches(z, i2, str2, i3, i4);
    }

    public static final String g(String str, String str2, String str3, boolean z) {
        f.z.d.k.e(str, "<this>");
        f.z.d.k.e(str2, "oldValue");
        f.z.d.k.e(str3, "newValue");
        int i2 = 0;
        int iR = t.r(str, str2, 0, z);
        if (iR < 0) {
            return str;
        }
        int length = str2.length();
        int iA = f.b0.n.a(length, 1);
        int length2 = (str.length() - length) + str3.length();
        if (length2 < 0) {
            throw new OutOfMemoryError();
        }
        StringBuilder sb = new StringBuilder(length2);
        do {
            sb.append((CharSequence) str, i2, iR);
            sb.append(str3);
            i2 = iR + length;
            if (iR >= str.length()) {
                break;
            }
            iR = t.r(str, str2, iR + iA, z);
        } while (iR > 0);
        sb.append((CharSequence) str, i2, str.length());
        String string = sb.toString();
        f.z.d.k.d(string, "stringBuilder.append(this, i, length).toString()");
        return string;
    }

    public static /* synthetic */ String h(String str, String str2, String str3, boolean z, int i2, Object obj) {
        if ((i2 & 4) != 0) {
            z = false;
        }
        return g(str, str2, str3, z);
    }

    public static final boolean i(String str, String str2, boolean z) {
        f.z.d.k.e(str, "<this>");
        f.z.d.k.e(str2, "prefix");
        return !z ? str.startsWith(str2) : f(str, 0, str2, 0, str2.length(), z);
    }

    public static /* synthetic */ boolean j(String str, String str2, boolean z, int i2, Object obj) {
        if ((i2 & 2) != 0) {
            z = false;
        }
        return i(str, str2, z);
    }
}
