package X6;

import com.google.android.gms.internal.measurement.X1;

/* JADX INFO: loaded from: classes.dex */
public abstract class m extends l {
    public static Integer E(String str) {
        boolean z8;
        int i;
        int i5;
        P6.g.e(str, "<this>");
        X1.f(10);
        int length = str.length();
        if (length == 0) {
            return null;
        }
        int i8 = 0;
        char cCharAt = str.charAt(0);
        int i9 = -2147483647;
        if (P6.g.f(cCharAt, 48) < 0) {
            i = 1;
            if (length == 1) {
                return null;
            }
            if (cCharAt == '+') {
                z8 = false;
            } else {
                if (cCharAt != '-') {
                    return null;
                }
                i9 = Integer.MIN_VALUE;
                z8 = true;
            }
        } else {
            z8 = false;
            i = 0;
        }
        int i10 = -59652323;
        while (i < length) {
            int iDigit = Character.digit((int) str.charAt(i), 10);
            if (iDigit < 0) {
                return null;
            }
            if ((i8 < i10 && (i10 != -59652323 || i8 < (i10 = i9 / 10))) || (i5 = i8 * 10) < i9 + iDigit) {
                return null;
            }
            i8 = i5 - iDigit;
            i++;
        }
        return z8 ? Integer.valueOf(i8) : Integer.valueOf(-i8);
    }

    public static Long F(String str) {
        boolean z8;
        P6.g.e(str, "<this>");
        X1.f(10);
        int length = str.length();
        if (length == 0) {
            return null;
        }
        int i = 0;
        char cCharAt = str.charAt(0);
        long j8 = -9223372036854775807L;
        if (P6.g.f(cCharAt, 48) < 0) {
            z8 = true;
            if (length == 1) {
                return null;
            }
            if (cCharAt == '+') {
                z8 = false;
                i = 1;
            } else {
                if (cCharAt != '-') {
                    return null;
                }
                j8 = Long.MIN_VALUE;
                i = 1;
            }
        } else {
            z8 = false;
        }
        long j9 = 0;
        long j10 = -256204778801521550L;
        while (i < length) {
            int iDigit = Character.digit((int) str.charAt(i), 10);
            if (iDigit < 0) {
                return null;
            }
            if (j9 < j10) {
                if (j10 != -256204778801521550L) {
                    return null;
                }
                j10 = j8 / ((long) 10);
                if (j9 < j10) {
                    return null;
                }
            }
            long j11 = j9 * ((long) 10);
            long j12 = iDigit;
            if (j11 < j8 + j12) {
                return null;
            }
            j9 = j11 - j12;
            i++;
        }
        return z8 ? Long.valueOf(j9) : Long.valueOf(-j9);
    }
}
