package defpackage;

import com.google.android.gms.internal.measurement.zzaeh;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;

/* JADX INFO: renamed from: ᵷʩˉᵬ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes3.dex */
public final class C4868 extends AbstractC5456 {

    /* JADX INFO: renamed from: ˌᵨʠᵫ, reason: contains not printable characters */
    public int f18558;

    /* JADX INFO: renamed from: ᵨᵼⁱ, reason: contains not printable characters */
    public final byte[] f18559;

    /* JADX INFO: renamed from: ᵶˇᵱ, reason: contains not printable characters */
    public int f18561;

    /* JADX INFO: renamed from: ᵸˆˁ, reason: contains not printable characters */
    public int f18562 = Integer.MAX_VALUE;

    /* JADX INFO: renamed from: ᵯᵷʽ, reason: contains not printable characters */
    public int f18560 = 0;

    /* JADX INFO: renamed from: ˈᵲᵢ, reason: contains not printable characters */
    public int f18557 = 0;

    public /* synthetic */ C4868(byte[] bArr) {
        this.f18559 = bArr;
    }

    /* JADX INFO: renamed from: ʽᵡᵢᵾ, reason: contains not printable characters */
    public final long m10113() throws zzaeh {
        long j = 0;
        for (int i = 0; i < 64; i += 7) {
            int i2 = this.f18557;
            if (i2 == this.f18560) {
                C1974.m5334("While parsing a protocol message, the input ended unexpectedly in the middle of a field.  This could mean either that the input has been truncated or that an embedded message misreported its own length.");
                return 0L;
            }
            this.f18557 = i2 + 1;
            byte b = this.f18559[i2];
            j |= ((long) (b & 127)) << i;
            if ((b & 128) == 0) {
                return j;
            }
        }
        C1974.m5334("CodedInputStream encountered a malformed varint.");
        return 0L;
    }

    @Override // defpackage.AbstractC5456
    /* JADX INFO: renamed from: ʿٴˇ */
    public final C0347 mo4119() throws zzaeh {
        int iM10115 = m10115();
        if (iM10115 > 0) {
            int i = this.f18560;
            int i2 = this.f18557;
            if (iM10115 <= i - i2) {
                C0347 c0347M9795 = AbstractC4667.m9795(this.f18559, i2, iM10115);
                this.f18557 += iM10115;
                return c0347M9795;
            }
        }
        if (iM10115 == 0) {
            return AbstractC4667.f17732;
        }
        byte[] bArrM10116 = m10116(iM10115);
        C0347 c0347 = AbstractC4667.f17732;
        return bArrM10116.length == 0 ? AbstractC4667.f17732 : new C0347(bArrM10116);
    }

    @Override // defpackage.AbstractC5456
    /* JADX INFO: renamed from: ˀᵭ */
    public final int mo4121() {
        return m10114();
    }

    @Override // defpackage.AbstractC5456
    /* JADX INFO: renamed from: ˁˌᵩ */
    public final int mo4123() {
        return m10115();
    }

    @Override // defpackage.AbstractC5456
    /* JADX INFO: renamed from: ˈᵲᵢ */
    public final int mo4124() {
        return m10114();
    }

    /* JADX INFO: renamed from: ˈⁱᵡ, reason: contains not printable characters */
    public final int m10114() throws zzaeh {
        int i = this.f18557;
        if (this.f18560 - i < 4) {
            C1974.m5334("While parsing a protocol message, the input ended unexpectedly in the middle of a field.  This could mean either that the input has been truncated or that an embedded message misreported its own length.");
            return 0;
        }
        this.f18557 = i + 4;
        byte[] bArr = this.f18559;
        int i2 = bArr[i] & 255;
        int i3 = bArr[i + 1] & 255;
        int i4 = bArr[i + 2] & 255;
        return ((bArr[i + 3] & 255) << 24) | (i3 << 8) | i2 | (i4 << 16);
    }

    @Override // defpackage.AbstractC5456
    /* JADX INFO: renamed from: ˉᵲ */
    public final int mo4126() throws zzaeh {
        if (mo4151()) {
            this.f18558 = 0;
            return 0;
        }
        int iM10115 = m10115();
        this.f18558 = iM10115;
        if ((iM10115 >>> 3) != 0) {
            return iM10115;
        }
        C1974.m5334("Protocol message contained an invalid tag (zero).");
        return 0;
    }

    @Override // defpackage.AbstractC5456
    /* JADX INFO: renamed from: ˉᵵᵜ */
    public final int mo4127() {
        return m10115();
    }

    /* JADX INFO: renamed from: ˊˌˊ, reason: contains not printable characters */
    public final int m10115() {
        int i;
        int i2 = this.f18557;
        int i3 = this.f18560;
        if (i3 != i2) {
            int i4 = i2 + 1;
            byte[] bArr = this.f18559;
            byte b = bArr[i2];
            if (b >= 0) {
                this.f18557 = i4;
                return b;
            }
            if (i3 - i4 >= 9) {
                int i5 = i2 + 2;
                int i6 = (bArr[i4] << 7) ^ b;
                if (i6 < 0) {
                    i = i6 ^ (-128);
                } else {
                    int i7 = i2 + 3;
                    int i8 = (bArr[i5] << 14) ^ i6;
                    if (i8 >= 0) {
                        i = i8 ^ 16256;
                    } else {
                        int i9 = i2 + 4;
                        int i10 = i8 ^ (bArr[i7] << 21);
                        if (i10 < 0) {
                            i = (-2080896) ^ i10;
                        } else {
                            i7 = i2 + 5;
                            byte b2 = bArr[i9];
                            int i11 = (i10 ^ (b2 << 28)) ^ 266354560;
                            if (b2 < 0) {
                                i9 = i2 + 6;
                                if (bArr[i7] < 0) {
                                    i7 = i2 + 7;
                                    if (bArr[i9] < 0) {
                                        i9 = i2 + 8;
                                        if (bArr[i7] < 0) {
                                            i7 = i2 + 9;
                                            if (bArr[i9] < 0) {
                                                int i12 = i2 + 10;
                                                if (bArr[i7] >= 0) {
                                                    i5 = i12;
                                                    i = i11;
                                                }
                                            }
                                        }
                                    }
                                }
                                i = i11;
                            }
                            i = i11;
                        }
                        i5 = i9;
                    }
                    i5 = i7;
                }
                this.f18557 = i5;
                return i;
            }
        }
        return (int) m10113();
    }

    @Override // defpackage.AbstractC5456
    /* JADX INFO: renamed from: ˊᵡᵗʨ */
    public final int mo4129() {
        return AbstractC5456.m11074(m10115());
    }

    @Override // defpackage.AbstractC5456
    /* JADX INFO: renamed from: ˊᵨᵧ */
    public final boolean mo4130(int i) throws zzaeh {
        int i2 = i & 7;
        if (i2 != 0) {
            if (i2 == 1) {
                mo4133(8);
                return true;
            }
            if (i2 == 2) {
                mo4133(m10115());
                return true;
            }
            if (i2 == 3) {
                m11076();
                mo4136(((i >>> 3) << 3) | 4);
                return true;
            }
            if (i2 == 4) {
                if (this.f20659 == 0) {
                    mo4136(0);
                }
                return false;
            }
            if (i2 == 5) {
                mo4133(4);
                return true;
            }
            C1974.m5335();
            return false;
        }
        int i3 = this.f18560 - this.f18557;
        byte[] bArr = this.f18559;
        if (i3 >= 10) {
            for (int i4 = 0; i4 < 10; i4++) {
                int i5 = this.f18557;
                this.f18557 = i5 + 1;
                if (bArr[i5] < 0) {
                }
            }
            C1974.m5334("CodedInputStream encountered a malformed varint.");
            return false;
        }
        for (int i6 = 0; i6 < 10; i6++) {
            int i7 = this.f18557;
            if (i7 == this.f18560) {
                C1974.m5334("While parsing a protocol message, the input ended unexpectedly in the middle of a field.  This could mean either that the input has been truncated or that an embedded message misreported its own length.");
                return false;
            }
            this.f18557 = i7 + 1;
            if (bArr[i7] < 0) {
            }
        }
        C1974.m5334("CodedInputStream encountered a malformed varint.");
        return false;
        return true;
    }

    @Override // defpackage.AbstractC5456
    /* JADX INFO: renamed from: ˊᵫᵗ */
    public final void mo4131(int i) {
        this.f18562 = i;
        int i2 = this.f18560 + this.f18561;
        this.f18560 = i2;
        if (i2 <= i) {
            this.f18561 = 0;
            return;
        }
        int i3 = i2 - i;
        this.f18561 = i3;
        this.f18560 = i2 - i3;
    }

    @Override // defpackage.AbstractC5456
    /* JADX INFO: renamed from: ˊᵾʽʼ */
    public final long mo4132() {
        return m10117();
    }

    @Override // defpackage.AbstractC5456
    /* JADX INFO: renamed from: ˋˈ */
    public final void mo4133(int i) throws zzaeh {
        if (i >= 0) {
            int i2 = this.f18560;
            int i3 = this.f18557;
            if (i <= i2 - i3) {
                this.f18557 = i3 + i;
                return;
            }
        }
        if (i < 0) {
            C1974.m5334("CodedInputStream encountered an embedded string or message which claimed to have negative size.");
        } else {
            C1974.m5334("While parsing a protocol message, the input ended unexpectedly in the middle of a field.  This could mean either that the input has been truncated or that an embedded message misreported its own length.");
        }
    }

    @Override // defpackage.AbstractC5456
    /* JADX INFO: renamed from: ˌᴵ */
    public final double mo4134() {
        return Double.longBitsToDouble(m10117());
    }

    @Override // defpackage.AbstractC5456
    /* JADX INFO: renamed from: ˌᵨʠᵫ */
    public final boolean mo4135() {
        return mo4138() != 0;
    }

    @Override // defpackage.AbstractC5456
    /* JADX INFO: renamed from: ˏːˆ */
    public final void mo4136(int i) throws zzaeh {
        if (this.f18558 == i) {
            return;
        }
        C1974.m5334("Protocol message end-group tag did not match expected tag.");
    }

    @Override // defpackage.AbstractC5456
    /* JADX INFO: renamed from: ˑʢ */
    public final long mo4138() {
        long j;
        long j2;
        long j3;
        int i = this.f18557;
        int i2 = this.f18560;
        if (i2 != i) {
            int i3 = i + 1;
            byte[] bArr = this.f18559;
            byte b = bArr[i];
            if (b >= 0) {
                this.f18557 = i3;
                return b;
            }
            if (i2 - i3 >= 9) {
                int i4 = i + 2;
                int i5 = (bArr[i3] << 7) ^ b;
                if (i5 < 0) {
                    j = i5 ^ (-128);
                } else {
                    int i6 = i + 3;
                    int i7 = (bArr[i4] << 14) ^ i5;
                    if (i7 >= 0) {
                        j = i7 ^ 16256;
                    } else {
                        int i8 = i + 4;
                        int i9 = i7 ^ (bArr[i6] << 21);
                        if (i9 < 0) {
                            long j4 = (-2080896) ^ i9;
                            i4 = i8;
                            j = j4;
                        } else {
                            i6 = i + 5;
                            long j5 = ((long) i9) ^ (((long) bArr[i8]) << 28);
                            if (j5 >= 0) {
                                j2 = 266354560;
                            } else {
                                int i10 = i + 6;
                                long j6 = j5 ^ (((long) bArr[i6]) << 35);
                                if (j6 < 0) {
                                    j3 = -34093383808L;
                                } else {
                                    i6 = i + 7;
                                    j5 = j6 ^ (((long) bArr[i10]) << 42);
                                    if (j5 >= 0) {
                                        j2 = 4363953127296L;
                                    } else {
                                        i10 = i + 8;
                                        j6 = j5 ^ (((long) bArr[i6]) << 49);
                                        if (j6 < 0) {
                                            j3 = -558586000294016L;
                                        } else {
                                            i6 = i + 9;
                                            j5 = j6 ^ (((long) bArr[i10]) << 56);
                                            if (j5 >= 0) {
                                                j2 = 71499008037633920L;
                                            } else {
                                                int i11 = i + 10;
                                                long j7 = j5 ^ (((long) bArr[i6]) << 63);
                                                if (j7 >= 0) {
                                                    j = j7 ^ (-9151873028817141888L);
                                                    i4 = i11;
                                                }
                                            }
                                        }
                                    }
                                }
                                j = j6 ^ j3;
                                i4 = i10;
                            }
                            j = j5 ^ j2;
                        }
                    }
                    i4 = i6;
                }
                this.f18557 = i4;
                return j;
            }
        }
        return m10113();
    }

    @Override // defpackage.AbstractC5456
    /* JADX INFO: renamed from: ˑˊᵲ */
    public final String mo4139() throws zzaeh {
        int iM10115 = m10115();
        if (iM10115 > 0) {
            int i = this.f18560;
            int i2 = this.f18557;
            if (iM10115 <= i - i2) {
                String strM10945 = AbstractC5355.m10945(this.f18559, i2, iM10115);
                this.f18557 += iM10115;
                return strM10945;
            }
        }
        if (iM10115 == 0) {
            return "";
        }
        if (iM10115 <= 0) {
            C1974.m5334("CodedInputStream encountered an embedded string or message which claimed to have negative size.");
            return null;
        }
        C1974.m5334("While parsing a protocol message, the input ended unexpectedly in the middle of a field.  This could mean either that the input has been truncated or that an embedded message misreported its own length.");
        return null;
    }

    @Override // defpackage.AbstractC5456
    /* JADX INFO: renamed from: ᵔᵖᵹᵫ */
    public final long mo4140() {
        return mo4138();
    }

    @Override // defpackage.AbstractC5456
    /* JADX INFO: renamed from: ᵛˑﹳ */
    public final long mo4142() {
        return AbstractC5456.m11072(mo4138());
    }

    @Override // defpackage.AbstractC5456
    /* JADX INFO: renamed from: ᵜᵪʾ */
    public final float mo4143() {
        return Float.intBitsToFloat(m10114());
    }

    @Override // defpackage.AbstractC5456
    /* JADX INFO: renamed from: ᵝᵶ */
    public final int mo4144(byte[] bArr, int i, int i2) {
        if ((bArr.length - i) - i2 < 0 || (i | i2) < 0) {
            C4468.m9514();
            return 0;
        }
        if (i2 == 0) {
            return 0;
        }
        int iMin = Math.min(i2, this.f18560 - this.f18557);
        if (iMin == 0) {
            return -1;
        }
        System.arraycopy(this.f18559, this.f18557, bArr, i, iMin);
        this.f18557 += iMin;
        return iMin;
    }

    /* JADX INFO: renamed from: ᵞᵛᵘ, reason: contains not printable characters */
    public final byte[] m10116(int i) throws zzaeh {
        if (i > 0) {
            int i2 = this.f18560;
            int i3 = this.f18557;
            if (i <= i2 - i3) {
                int i4 = i + i3;
                this.f18557 = i4;
                return Arrays.copyOfRange(this.f18559, i3, i4);
            }
        }
        if (i > 0) {
            C1974.m5334("While parsing a protocol message, the input ended unexpectedly in the middle of a field.  This could mean either that the input has been truncated or that an embedded message misreported its own length.");
            return null;
        }
        if (i == 0) {
            return AbstractC5240.f19754;
        }
        C1974.m5334("CodedInputStream encountered an embedded string or message which claimed to have negative size.");
        return null;
    }

    @Override // defpackage.AbstractC5456
    /* JADX INFO: renamed from: ᵠˏˏ */
    public final byte[] mo4146() {
        return m10116(m10115());
    }

    /* JADX INFO: renamed from: ᵨˈʼﹶ, reason: contains not printable characters */
    public final long m10117() throws zzaeh {
        int i = this.f18557;
        if (this.f18560 - i < 8) {
            C1974.m5334("While parsing a protocol message, the input ended unexpectedly in the middle of a field.  This could mean either that the input has been truncated or that an embedded message misreported its own length.");
            return 0L;
        }
        this.f18557 = i + 8;
        byte[] bArr = this.f18559;
        long j = bArr[i];
        long j2 = (((long) bArr[i + 1]) & 255) << 8;
        long j3 = bArr[i + 2];
        long j4 = bArr[i + 3];
        long j5 = bArr[i + 4];
        return ((((long) bArr[i + 7]) & 255) << 56) | j2 | (j & 255) | ((j3 & 255) << 16) | ((j4 & 255) << 24) | ((j5 & 255) << 32) | ((bArr[i + 5] & 255) << 40) | ((bArr[i + 6] & 255) << 48);
    }

    @Override // defpackage.AbstractC5456
    /* JADX INFO: renamed from: ᵨᵼⁱ */
    public final long mo4148() {
        return mo4138();
    }

    @Override // defpackage.AbstractC5456
    /* JADX INFO: renamed from: ᵮᵣᵗˈ */
    public final int mo4149() {
        return this.f18557;
    }

    @Override // defpackage.AbstractC5456
    /* JADX INFO: renamed from: ᵯᵷʽ */
    public final int mo4150() {
        return m10115();
    }

    @Override // defpackage.AbstractC5456
    /* JADX INFO: renamed from: ᵱᵽʡᵚ */
    public final boolean mo4151() {
        return this.f18557 == this.f18560;
    }

    @Override // defpackage.AbstractC5456
    /* JADX INFO: renamed from: ᵵᵬᵽ */
    public final int mo4152() {
        return m10115();
    }

    @Override // defpackage.AbstractC5456
    /* JADX INFO: renamed from: ᵵᵽ */
    public final int mo4153(int i) throws zzaeh {
        if (i < 0) {
            C1974.m5334("CodedInputStream encountered an embedded string or message which claimed to have negative size.");
            return 0;
        }
        int i2 = i + this.f18557;
        if (i2 < 0) {
            C1974.m5334("Protocol message was too large.  May be malicious.  Use CodedInputStream.setSizeLimit() to increase the size limit. If reading multiple messages, consider resetting the counter between each message using CodedInputStream.resetSizeCounter().");
            return 0;
        }
        int i3 = this.f18562;
        if (i2 > i3) {
            C1974.m5334("While parsing a protocol message, the input ended unexpectedly in the middle of a field.  This could mean either that the input has been truncated or that an embedded message misreported its own length.");
            return 0;
        }
        this.f18562 = i2;
        int i4 = this.f18560 + this.f18561;
        this.f18560 = i4;
        if (i4 <= i2) {
            this.f18561 = 0;
            return i3;
        }
        int i5 = i4 - i2;
        this.f18561 = i5;
        this.f18560 = i4 - i5;
        return i3;
    }

    @Override // defpackage.AbstractC5456
    /* JADX INFO: renamed from: ᵶˇᵱ */
    public final long mo4154() {
        return m10117();
    }

    @Override // defpackage.AbstractC5456
    /* JADX INFO: renamed from: ᵸˆˁ */
    public final String mo4155() throws zzaeh {
        int iM10115 = m10115();
        if (iM10115 > 0) {
            int i = this.f18560;
            int i2 = this.f18557;
            if (iM10115 <= i - i2) {
                String str = new String(this.f18559, i2, iM10115, StandardCharsets.UTF_8);
                this.f18557 += iM10115;
                return str;
            }
        }
        if (iM10115 == 0) {
            return "";
        }
        if (iM10115 < 0) {
            C1974.m5334("CodedInputStream encountered an embedded string or message which claimed to have negative size.");
            return null;
        }
        C1974.m5334("While parsing a protocol message, the input ended unexpectedly in the middle of a field.  This could mean either that the input has been truncated or that an embedded message misreported its own length.");
        return null;
    }

    @Override // defpackage.AbstractC5456
    /* JADX INFO: renamed from: ᵻʽᵯ */
    public final int mo4156() {
        int i = this.f18562;
        if (i == Integer.MAX_VALUE) {
            return -1;
        }
        return i - this.f18557;
    }
}
