package defpackage;

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

/* renamed from: ᵲᵗᵭ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public final class C4496 extends AbstractC3415 {

    /* renamed from: ᵡˎ, reason: contains not printable characters */
    public int f16753;

    /* renamed from: ᵡⁱᵥ, reason: contains not printable characters */
    public int f16754;

    /* renamed from: ᵾᵬ, reason: contains not printable characters */
    public final byte[] f16756;

    /* renamed from: ˑᵥˁ, reason: contains not printable characters */
    public int f16752 = Integer.MAX_VALUE;

    /* renamed from: ᵤᵙᵷ, reason: contains not printable characters */
    public int f16755 = 0;

    /* renamed from: ˀᵗᵝᵭ, reason: contains not printable characters */
    public int f16751 = 0;

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

    @Override // defpackage.AbstractC3415
    /* renamed from: ˀᵗᵝᵭ */
    public final int mo5558() {
        return m9571();
    }

    /* renamed from: ˀᵗᵩ, reason: contains not printable characters */
    public final int m9571() throws zzaeh {
        int i = this.f16751;
        if (this.f16755 - i < 4) {
            C1499.m4426("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.f16751 = i + 4;
        byte[] bArr = this.f16756;
        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.AbstractC3415
    /* renamed from: ˁˑᵰ */
    public final long mo5560() {
        return m9572();
    }

    /* renamed from: ˆᵼᵷˊ, reason: contains not printable characters */
    public final long m9572() throws zzaeh {
        int i = this.f16751;
        if (this.f16755 - i < 8) {
            C1499.m4426("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.f16751 = i + 8;
        byte[] bArr = this.f16756;
        long j = bArr[i];
        long j2 = bArr[i + 2];
        long j3 = bArr[i + 3];
        long j4 = bArr[i + 4];
        return ((bArr[i + 7] & 255) << 56) | ((bArr[i + 1] & 255) << 8) | (j & 255) | ((j2 & 255) << 16) | ((j3 & 255) << 24) | ((j4 & 255) << 32) | ((bArr[i + 5] & 255) << 40) | ((bArr[i + 6] & 255) << 48);
    }

    /* renamed from: ˊᵸˊ, reason: contains not printable characters */
    public final long m9573() throws zzaeh {
        long j = 0;
        for (int i = 0; i < 64; i += 7) {
            int i2 = this.f16751;
            if (i2 == this.f16755) {
                C1499.m4426("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.f16751 = i2 + 1;
            j |= (r5 & Byte.MAX_VALUE) << i;
            if ((this.f16756[i2] & 128) == 0) {
                return j;
            }
        }
        C1499.m4426("CodedInputStream encountered a malformed varint.");
        return 0L;
    }

    @Override // defpackage.AbstractC3415
    /* renamed from: ˌᵜᵹᵩ */
    public final int mo5564() {
        return this.f16751;
    }

    /* renamed from: ˌᵪ, reason: contains not printable characters */
    public final int m9574() {
        int i;
        int i2 = this.f16751;
        int i3 = this.f16755;
        if (i3 != i2) {
            int i4 = i2 + 1;
            byte[] bArr = this.f16756;
            byte b = bArr[i2];
            if (b >= 0) {
                this.f16751 = 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.f16751 = i5;
                return i;
            }
        }
        return (int) m9573();
    }

    @Override // defpackage.AbstractC3415
    /* renamed from: ˎˏʜʾ */
    public final int mo5566(int i) throws zzaeh {
        if (i < 0) {
            C1499.m4426("CodedInputStream encountered an embedded string or message which claimed to have negative size.");
            return 0;
        }
        int i2 = i + this.f16751;
        if (i2 < 0) {
            C1499.m4426("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.f16752;
        if (i2 > i3) {
            C1499.m4426("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.f16752 = i2;
        int i4 = this.f16755 + this.f16754;
        this.f16755 = i4;
        if (i4 <= i2) {
            this.f16754 = 0;
            return i3;
        }
        int i5 = i4 - i2;
        this.f16754 = i5;
        this.f16755 = i4 - i5;
        return i3;
    }

    @Override // defpackage.AbstractC3415
    /* renamed from: ˎˑː */
    public final String mo5567() throws zzaeh {
        int iM9574 = m9574();
        if (iM9574 > 0) {
            int i = this.f16755;
            int i2 = this.f16751;
            if (iM9574 <= i - i2) {
                String strM4345 = AbstractC1440.m4345(this.f16756, i2, iM9574);
                this.f16751 += iM9574;
                return strM4345;
            }
        }
        if (iM9574 == 0) {
            return "";
        }
        if (iM9574 <= 0) {
            C1499.m4426("CodedInputStream encountered an embedded string or message which claimed to have negative size.");
            return null;
        }
        C1499.m4426("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.AbstractC3415
    /* renamed from: ˑᵝﹳᵜ */
    public final long mo5569() {
        long j;
        long j2;
        long j3;
        int i = this.f16751;
        int i2 = this.f16755;
        if (i2 != i) {
            int i3 = i + 1;
            byte[] bArr = this.f16756;
            byte b = bArr[i];
            if (b >= 0) {
                this.f16751 = 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 = i9 ^ (bArr[i8] << 28);
                            if (j5 >= 0) {
                                j2 = 266354560;
                            } else {
                                int i10 = i + 6;
                                long j6 = j5 ^ (bArr[i6] << 35);
                                if (j6 < 0) {
                                    j3 = -34093383808L;
                                } else {
                                    i6 = i + 7;
                                    j5 = j6 ^ (bArr[i10] << 42);
                                    if (j5 >= 0) {
                                        j2 = 4363953127296L;
                                    } else {
                                        i10 = i + 8;
                                        j6 = j5 ^ (bArr[i6] << 49);
                                        if (j6 < 0) {
                                            j3 = -558586000294016L;
                                        } else {
                                            i6 = i + 9;
                                            j5 = j6 ^ (bArr[i10] << 56);
                                            if (j5 >= 0) {
                                                j2 = 71499008037633920L;
                                            } else {
                                                int i11 = i + 10;
                                                long j7 = j5 ^ (bArr[i6] << 63);
                                                if (j7 >= 0) {
                                                    j = j7 ^ (-9151873028817141888L);
                                                    i4 = i11;
                                                }
                                            }
                                        }
                                    }
                                }
                                j = j6 ^ j3;
                                i4 = i10;
                            }
                            j = j5 ^ j2;
                        }
                    }
                    i4 = i6;
                }
                this.f16751 = i4;
                return j;
            }
        }
        return m9573();
    }

    @Override // defpackage.AbstractC3415
    /* renamed from: ˑᵥˁ */
    public final String mo5570() throws zzaeh {
        int iM9574 = m9574();
        if (iM9574 > 0) {
            int i = this.f16755;
            int i2 = this.f16751;
            if (iM9574 <= i - i2) {
                String str = new String(this.f16756, i2, iM9574, StandardCharsets.UTF_8);
                this.f16751 += iM9574;
                return str;
            }
        }
        if (iM9574 == 0) {
            return "";
        }
        if (iM9574 < 0) {
            C1499.m4426("CodedInputStream encountered an embedded string or message which claimed to have negative size.");
            return null;
        }
        C1499.m4426("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.AbstractC3415
    /* renamed from: ˑᵱ */
    public final boolean mo5571(int i) throws zzaeh {
        int i2 = i & 7;
        if (i2 != 0) {
            if (i2 == 1) {
                mo5586(8);
                return true;
            }
            if (i2 == 2) {
                mo5586(m9574());
                return true;
            }
            if (i2 == 3) {
                m7777();
                mo5585(((i >>> 3) << 3) | 4);
                return true;
            }
            if (i2 == 4) {
                if (this.f12707 == 0) {
                    mo5585(0);
                }
                return false;
            }
            if (i2 == 5) {
                mo5586(4);
                return true;
            }
            C1499.m4428();
            return false;
        }
        int i3 = this.f16755 - this.f16751;
        byte[] bArr = this.f16756;
        if (i3 >= 10) {
            for (int i4 = 0; i4 < 10; i4++) {
                int i5 = this.f16751;
                this.f16751 = i5 + 1;
                if (bArr[i5] < 0) {
                }
            }
            C1499.m4426("CodedInputStream encountered a malformed varint.");
            return false;
        }
        for (int i6 = 0; i6 < 10; i6++) {
            int i7 = this.f16751;
            if (i7 == this.f16755) {
                C1499.m4426("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.f16751 = i7 + 1;
            if (bArr[i7] < 0) {
            }
        }
        C1499.m4426("CodedInputStream encountered a malformed varint.");
        return false;
        return true;
    }

    @Override // defpackage.AbstractC3415
    /* renamed from: ᐧﾞ */
    public final int mo5572() {
        return m9574();
    }

    @Override // defpackage.AbstractC3415
    /* renamed from: ᵙᵢᵨᵳ */
    public final long mo5573() {
        return AbstractC3415.m7776(mo5569());
    }

    /* renamed from: ᵛˈᵤ, reason: contains not printable characters */
    public final byte[] m9575(int i) throws zzaeh {
        if (i > 0) {
            int i2 = this.f16755;
            int i3 = this.f16751;
            if (i <= i2 - i3) {
                int i4 = i + i3;
                this.f16751 = i4;
                return Arrays.copyOfRange(this.f16756, i3, i4);
            }
        }
        if (i > 0) {
            C1499.m4426("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 AbstractC0357.f2110;
        }
        C1499.m4426("CodedInputStream encountered an embedded string or message which claimed to have negative size.");
        return null;
    }

    @Override // defpackage.AbstractC3415
    /* renamed from: ᵝᵵᵺ */
    public final int mo5575() {
        int i = this.f16752;
        if (i == Integer.MAX_VALUE) {
            return -1;
        }
        return i - this.f16751;
    }

    @Override // defpackage.AbstractC3415
    /* renamed from: ᵞʡ */
    public final int mo5576() throws zzaeh {
        if (mo5591()) {
            this.f16753 = 0;
            return 0;
        }
        int iM9574 = m9574();
        this.f16753 = iM9574;
        if ((iM9574 >>> 3) != 0) {
            return iM9574;
        }
        C1499.m4426("Protocol message contained an invalid tag (zero).");
        return 0;
    }

    @Override // defpackage.AbstractC3415
    /* renamed from: ᵡˎ */
    public final boolean mo5577() {
        return mo5569() != 0;
    }

    @Override // defpackage.AbstractC3415
    /* renamed from: ᵡᵘˎʽ */
    public final int mo5578() {
        return m9574();
    }

    @Override // defpackage.AbstractC3415
    /* renamed from: ᵡⁱᵥ */
    public final long mo5580() {
        return m9572();
    }

    @Override // defpackage.AbstractC3415
    /* renamed from: ᵢˇᵭ */
    public final float mo5581() {
        return Float.intBitsToFloat(m9571());
    }

    @Override // defpackage.AbstractC3415
    /* renamed from: ᵤᵙᵷ */
    public final int mo5582() {
        return m9574();
    }

    @Override // defpackage.AbstractC3415
    /* renamed from: ᵧـˌᵎ */
    public final byte[] mo5583() {
        return m9575(m9574());
    }

    @Override // defpackage.AbstractC3415
    /* renamed from: ᵧᵾˀˈ */
    public final double mo5584() {
        return Double.longBitsToDouble(m9572());
    }

    @Override // defpackage.AbstractC3415
    /* renamed from: ᵨᵳʝ */
    public final void mo5585(int i) throws zzaeh {
        if (this.f16753 == i) {
            return;
        }
        C1499.m4426("Protocol message end-group tag did not match expected tag.");
    }

    @Override // defpackage.AbstractC3415
    /* renamed from: ᵪʩ */
    public final void mo5586(int i) throws zzaeh {
        if (i >= 0) {
            int i2 = this.f16755;
            int i3 = this.f16751;
            if (i <= i2 - i3) {
                this.f16751 = i3 + i;
                return;
            }
        }
        if (i < 0) {
            C1499.m4426("CodedInputStream encountered an embedded string or message which claimed to have negative size.");
        } else {
            C1499.m4426("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.AbstractC3415
    /* renamed from: ᵮᵠـˌ */
    public final C2492 mo5587() throws zzaeh {
        int iM9574 = m9574();
        if (iM9574 > 0) {
            int i = this.f16755;
            int i2 = this.f16751;
            if (iM9574 <= i - i2) {
                C2492 c2492M6634 = AbstractC2646.m6634(this.f16756, i2, iM9574);
                this.f16751 += iM9574;
                return c2492M6634;
            }
        }
        if (iM9574 == 0) {
            return AbstractC2646.f10247;
        }
        byte[] bArrM9575 = m9575(iM9574);
        C2492 c2492 = AbstractC2646.f10247;
        return bArrM9575.length == 0 ? AbstractC2646.f10247 : new C2492(bArrM9575);
    }

    @Override // defpackage.AbstractC3415
    /* renamed from: ᵯٴᵦ */
    public final int mo5588(byte[] bArr, int i, int i2) {
        if ((bArr.length - i) - i2 < 0 || (i | i2) < 0) {
            C0190.m1431();
            return 0;
        }
        if (i2 == 0) {
            return 0;
        }
        int iMin = Math.min(i2, this.f16755 - this.f16751);
        if (iMin == 0) {
            return -1;
        }
        System.arraycopy(this.f16756, this.f16751, bArr, i, iMin);
        this.f16751 += iMin;
        return iMin;
    }

    @Override // defpackage.AbstractC3415
    /* renamed from: ᵶʔᵢˊ */
    public final int mo5590() {
        return m9571();
    }

    @Override // defpackage.AbstractC3415
    /* renamed from: ᵶᵷᵕ */
    public final boolean mo5591() {
        return this.f16751 == this.f16755;
    }

    @Override // defpackage.AbstractC3415
    /* renamed from: ᵹᵝᵶ */
    public final void mo5592(int i) {
        this.f16752 = i;
        int i2 = this.f16755 + this.f16754;
        this.f16755 = i2;
        if (i2 <= i) {
            this.f16754 = 0;
            return;
        }
        int i3 = i2 - i;
        this.f16754 = i3;
        this.f16755 = i2 - i3;
    }

    @Override // defpackage.AbstractC3415
    /* renamed from: ᵺʙ */
    public final int mo5593() {
        return m9574();
    }

    @Override // defpackage.AbstractC3415
    /* renamed from: ᵾᵬ */
    public final long mo5594() {
        return mo5569();
    }

    @Override // defpackage.AbstractC3415
    /* renamed from: ᵿʗᵝʽ */
    public final long mo5595() {
        return mo5569();
    }

    @Override // defpackage.AbstractC3415
    /* renamed from: ﾞⁱ */
    public final int mo5596() {
        return AbstractC3415.m7774(m9574());
    }
}
