package androidx.datastore.preferences.protobuf;

import com.google.crypto.tink.shaded.protobuf.AbstractC0738d;
import com.google.crypto.tink.shaded.protobuf.AbstractC0742h;
import com.google.crypto.tink.shaded.protobuf.AbstractC0746l;
import com.google.crypto.tink.shaded.protobuf.AbstractC0756w;
import com.google.crypto.tink.shaded.protobuf.AbstractC0759z;
import com.google.crypto.tink.shaded.protobuf.C0748n;
import java.nio.charset.Charset;
import java.util.List;
import java.util.NoSuchElementException;
import n4.u0;
import o6.C1400t;
import r.AbstractC1481a;

/* JADX INFO: renamed from: androidx.datastore.preferences.protobuf.j, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public final class C0432j {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final /* synthetic */ int f8095a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public int f8096b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public int f8097c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public int f8098d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public Object f8099e;

    public /* synthetic */ C0432j(int i, byte b8) {
        this.f8095a = i;
    }

    public static void Z(int i) throws com.google.crypto.tink.shaded.protobuf.B {
        if ((i & 3) != 0) {
            throw com.google.crypto.tink.shaded.protobuf.B.f();
        }
    }

    public static void a0(int i) throws com.google.crypto.tink.shaded.protobuf.B {
        if ((i & 7) != 0) {
            throw com.google.crypto.tink.shaded.protobuf.B.f();
        }
    }

    public void A(InterfaceC0443v interfaceC0443v) throws C0446y, com.google.crypto.tink.shaded.protobuf.B {
        int iC;
        int i = this.f8096b & 7;
        J3.e eVar = (J3.e) this.f8099e;
        if (i == 0) {
            do {
                ((S) interfaceC0443v).add(Integer.valueOf(eVar.u()));
                if (eVar.g()) {
                    return;
                } else {
                    iC = eVar.C();
                }
            } while (iC == this.f8096b);
            this.f8098d = iC;
            return;
        }
        if (i != 2) {
            throw C0446y.b();
        }
        int iF = eVar.f() + eVar.D();
        do {
            ((S) interfaceC0443v).add(Integer.valueOf(eVar.u()));
        } while (eVar.f() < iF);
        V(iF);
    }

    public void B(List list) throws C0446y, com.google.crypto.tink.shaded.protobuf.B {
        int iC;
        int iC2;
        boolean z8 = list instanceof AbstractC0756w;
        J3.e eVar = (J3.e) this.f8099e;
        if (!z8) {
            int i = this.f8096b & 7;
            if (i == 0) {
                do {
                    list.add(Integer.valueOf(eVar.u()));
                    if (eVar.g()) {
                        return;
                    } else {
                        iC = eVar.C();
                    }
                } while (iC == this.f8096b);
                this.f8098d = iC;
                return;
            }
            if (i != 2) {
                throw com.google.crypto.tink.shaded.protobuf.B.c();
            }
            int iF = eVar.f() + eVar.D();
            do {
                list.add(Integer.valueOf(eVar.u()));
            } while (eVar.f() < iF);
            V(iF);
            return;
        }
        AbstractC0756w abstractC0756w = (AbstractC0756w) list;
        int i5 = this.f8096b & 7;
        if (i5 == 0) {
            do {
                abstractC0756w.b(eVar.u());
                if (eVar.g()) {
                    return;
                } else {
                    iC2 = eVar.C();
                }
            } while (iC2 == this.f8096b);
            this.f8098d = iC2;
            return;
        }
        if (i5 != 2) {
            throw com.google.crypto.tink.shaded.protobuf.B.c();
        }
        int iF2 = eVar.f() + eVar.D();
        do {
            abstractC0756w.b(eVar.u());
        } while (eVar.f() < iF2);
        V(iF2);
    }

    public void C(InterfaceC0443v interfaceC0443v) throws C0446y, com.google.crypto.tink.shaded.protobuf.B {
        int iC;
        int i = this.f8096b & 7;
        J3.e eVar = (J3.e) this.f8099e;
        if (i == 0) {
            do {
                ((S) interfaceC0443v).add(Long.valueOf(eVar.v()));
                if (eVar.g()) {
                    return;
                } else {
                    iC = eVar.C();
                }
            } while (iC == this.f8096b);
            this.f8098d = iC;
            return;
        }
        if (i != 2) {
            throw C0446y.b();
        }
        int iF = eVar.f() + eVar.D();
        do {
            ((S) interfaceC0443v).add(Long.valueOf(eVar.v()));
        } while (eVar.f() < iF);
        V(iF);
    }

    public void D(List list) throws C0446y, com.google.crypto.tink.shaded.protobuf.B {
        int iC;
        int iC2;
        boolean z8 = list instanceof com.google.crypto.tink.shaded.protobuf.I;
        J3.e eVar = (J3.e) this.f8099e;
        if (!z8) {
            int i = this.f8096b & 7;
            if (i == 0) {
                do {
                    list.add(Long.valueOf(eVar.v()));
                    if (eVar.g()) {
                        return;
                    } else {
                        iC = eVar.C();
                    }
                } while (iC == this.f8096b);
                this.f8098d = iC;
                return;
            }
            if (i != 2) {
                throw com.google.crypto.tink.shaded.protobuf.B.c();
            }
            int iF = eVar.f() + eVar.D();
            do {
                list.add(Long.valueOf(eVar.v()));
            } while (eVar.f() < iF);
            V(iF);
            return;
        }
        com.google.crypto.tink.shaded.protobuf.I i5 = (com.google.crypto.tink.shaded.protobuf.I) list;
        int i8 = this.f8096b & 7;
        if (i8 == 0) {
            do {
                i5.b(eVar.v());
                if (eVar.g()) {
                    return;
                } else {
                    iC2 = eVar.C();
                }
            } while (iC2 == this.f8096b);
            this.f8098d = iC2;
            return;
        }
        if (i8 != 2) {
            throw com.google.crypto.tink.shaded.protobuf.B.c();
        }
        int iF2 = eVar.f() + eVar.D();
        do {
            i5.b(eVar.v());
        } while (eVar.f() < iF2);
        V(iF2);
    }

    public void E(InterfaceC0443v interfaceC0443v) throws C0446y {
        int iC;
        int i = this.f8096b & 7;
        J3.e eVar = (J3.e) this.f8099e;
        if (i == 2) {
            int iD = eVar.D();
            if ((iD & 3) != 0) {
                throw new C0446y("Failed to parse the message.");
            }
            int iF = eVar.f() + iD;
            do {
                ((S) interfaceC0443v).add(Integer.valueOf(eVar.w()));
            } while (eVar.f() < iF);
            return;
        }
        if (i != 5) {
            throw C0446y.b();
        }
        do {
            ((S) interfaceC0443v).add(Integer.valueOf(eVar.w()));
            if (eVar.g()) {
                return;
            } else {
                iC = eVar.C();
            }
        } while (iC == this.f8096b);
        this.f8098d = iC;
    }

    public void F(List list) throws com.google.crypto.tink.shaded.protobuf.B {
        int iC;
        int iC2;
        boolean z8 = list instanceof AbstractC0756w;
        J3.e eVar = (J3.e) this.f8099e;
        if (!z8) {
            int i = this.f8096b & 7;
            if (i == 2) {
                int iD = eVar.D();
                Z(iD);
                int iF = eVar.f() + iD;
                do {
                    list.add(Integer.valueOf(eVar.w()));
                } while (eVar.f() < iF);
                return;
            }
            if (i != 5) {
                throw com.google.crypto.tink.shaded.protobuf.B.c();
            }
            do {
                list.add(Integer.valueOf(eVar.w()));
                if (eVar.g()) {
                    return;
                } else {
                    iC = eVar.C();
                }
            } while (iC == this.f8096b);
            this.f8098d = iC;
            return;
        }
        AbstractC0756w abstractC0756w = (AbstractC0756w) list;
        int i5 = this.f8096b & 7;
        if (i5 == 2) {
            int iD2 = eVar.D();
            Z(iD2);
            int iF2 = eVar.f() + iD2;
            do {
                abstractC0756w.b(eVar.w());
            } while (eVar.f() < iF2);
            return;
        }
        if (i5 != 5) {
            throw com.google.crypto.tink.shaded.protobuf.B.c();
        }
        do {
            abstractC0756w.b(eVar.w());
            if (eVar.g()) {
                return;
            } else {
                iC2 = eVar.C();
            }
        } while (iC2 == this.f8096b);
        this.f8098d = iC2;
    }

    public void G(InterfaceC0443v interfaceC0443v) throws C0446y {
        int iC;
        int i = this.f8096b & 7;
        J3.e eVar = (J3.e) this.f8099e;
        if (i == 1) {
            do {
                ((S) interfaceC0443v).add(Long.valueOf(eVar.x()));
                if (eVar.g()) {
                    return;
                } else {
                    iC = eVar.C();
                }
            } while (iC == this.f8096b);
            this.f8098d = iC;
            return;
        }
        if (i != 2) {
            throw C0446y.b();
        }
        int iD = eVar.D();
        if ((iD & 7) != 0) {
            throw new C0446y("Failed to parse the message.");
        }
        int iF = eVar.f() + iD;
        do {
            ((S) interfaceC0443v).add(Long.valueOf(eVar.x()));
        } while (eVar.f() < iF);
    }

    public void H(List list) throws com.google.crypto.tink.shaded.protobuf.B {
        int iC;
        int iC2;
        boolean z8 = list instanceof com.google.crypto.tink.shaded.protobuf.I;
        J3.e eVar = (J3.e) this.f8099e;
        if (!z8) {
            int i = this.f8096b & 7;
            if (i == 1) {
                do {
                    list.add(Long.valueOf(eVar.x()));
                    if (eVar.g()) {
                        return;
                    } else {
                        iC = eVar.C();
                    }
                } while (iC == this.f8096b);
                this.f8098d = iC;
                return;
            }
            if (i != 2) {
                throw com.google.crypto.tink.shaded.protobuf.B.c();
            }
            int iD = eVar.D();
            a0(iD);
            int iF = eVar.f() + iD;
            do {
                list.add(Long.valueOf(eVar.x()));
            } while (eVar.f() < iF);
            return;
        }
        com.google.crypto.tink.shaded.protobuf.I i5 = (com.google.crypto.tink.shaded.protobuf.I) list;
        int i8 = this.f8096b & 7;
        if (i8 == 1) {
            do {
                i5.b(eVar.x());
                if (eVar.g()) {
                    return;
                } else {
                    iC2 = eVar.C();
                }
            } while (iC2 == this.f8096b);
            this.f8098d = iC2;
            return;
        }
        if (i8 != 2) {
            throw com.google.crypto.tink.shaded.protobuf.B.c();
        }
        int iD2 = eVar.D();
        a0(iD2);
        int iF2 = eVar.f() + iD2;
        do {
            i5.b(eVar.x());
        } while (eVar.f() < iF2);
    }

    public void I(InterfaceC0443v interfaceC0443v) throws C0446y, com.google.crypto.tink.shaded.protobuf.B {
        int iC;
        int i = this.f8096b & 7;
        J3.e eVar = (J3.e) this.f8099e;
        if (i == 0) {
            do {
                ((S) interfaceC0443v).add(Integer.valueOf(eVar.y()));
                if (eVar.g()) {
                    return;
                } else {
                    iC = eVar.C();
                }
            } while (iC == this.f8096b);
            this.f8098d = iC;
            return;
        }
        if (i != 2) {
            throw C0446y.b();
        }
        int iF = eVar.f() + eVar.D();
        do {
            ((S) interfaceC0443v).add(Integer.valueOf(eVar.y()));
        } while (eVar.f() < iF);
        V(iF);
    }

    public void J(List list) throws C0446y, com.google.crypto.tink.shaded.protobuf.B {
        int iC;
        int iC2;
        boolean z8 = list instanceof AbstractC0756w;
        J3.e eVar = (J3.e) this.f8099e;
        if (!z8) {
            int i = this.f8096b & 7;
            if (i == 0) {
                do {
                    list.add(Integer.valueOf(eVar.y()));
                    if (eVar.g()) {
                        return;
                    } else {
                        iC = eVar.C();
                    }
                } while (iC == this.f8096b);
                this.f8098d = iC;
                return;
            }
            if (i != 2) {
                throw com.google.crypto.tink.shaded.protobuf.B.c();
            }
            int iF = eVar.f() + eVar.D();
            do {
                list.add(Integer.valueOf(eVar.y()));
            } while (eVar.f() < iF);
            V(iF);
            return;
        }
        AbstractC0756w abstractC0756w = (AbstractC0756w) list;
        int i5 = this.f8096b & 7;
        if (i5 == 0) {
            do {
                abstractC0756w.b(eVar.y());
                if (eVar.g()) {
                    return;
                } else {
                    iC2 = eVar.C();
                }
            } while (iC2 == this.f8096b);
            this.f8098d = iC2;
            return;
        }
        if (i5 != 2) {
            throw com.google.crypto.tink.shaded.protobuf.B.c();
        }
        int iF2 = eVar.f() + eVar.D();
        do {
            abstractC0756w.b(eVar.y());
        } while (eVar.f() < iF2);
        V(iF2);
    }

    public void K(InterfaceC0443v interfaceC0443v) throws C0446y, com.google.crypto.tink.shaded.protobuf.B {
        int iC;
        int i = this.f8096b & 7;
        J3.e eVar = (J3.e) this.f8099e;
        if (i == 0) {
            do {
                ((S) interfaceC0443v).add(Long.valueOf(eVar.z()));
                if (eVar.g()) {
                    return;
                } else {
                    iC = eVar.C();
                }
            } while (iC == this.f8096b);
            this.f8098d = iC;
            return;
        }
        if (i != 2) {
            throw C0446y.b();
        }
        int iF = eVar.f() + eVar.D();
        do {
            ((S) interfaceC0443v).add(Long.valueOf(eVar.z()));
        } while (eVar.f() < iF);
        V(iF);
    }

    public void L(List list) throws C0446y, com.google.crypto.tink.shaded.protobuf.B {
        int iC;
        int iC2;
        boolean z8 = list instanceof com.google.crypto.tink.shaded.protobuf.I;
        J3.e eVar = (J3.e) this.f8099e;
        if (!z8) {
            int i = this.f8096b & 7;
            if (i == 0) {
                do {
                    list.add(Long.valueOf(eVar.z()));
                    if (eVar.g()) {
                        return;
                    } else {
                        iC = eVar.C();
                    }
                } while (iC == this.f8096b);
                this.f8098d = iC;
                return;
            }
            if (i != 2) {
                throw com.google.crypto.tink.shaded.protobuf.B.c();
            }
            int iF = eVar.f() + eVar.D();
            do {
                list.add(Long.valueOf(eVar.z()));
            } while (eVar.f() < iF);
            V(iF);
            return;
        }
        com.google.crypto.tink.shaded.protobuf.I i5 = (com.google.crypto.tink.shaded.protobuf.I) list;
        int i8 = this.f8096b & 7;
        if (i8 == 0) {
            do {
                i5.b(eVar.z());
                if (eVar.g()) {
                    return;
                } else {
                    iC2 = eVar.C();
                }
            } while (iC2 == this.f8096b);
            this.f8098d = iC2;
            return;
        }
        if (i8 != 2) {
            throw com.google.crypto.tink.shaded.protobuf.B.c();
        }
        int iF2 = eVar.f() + eVar.D();
        do {
            i5.b(eVar.z());
        } while (eVar.f() < iF2);
        V(iF2);
    }

    public void M(InterfaceC0443v interfaceC0443v, boolean z8) throws com.google.crypto.tink.shaded.protobuf.A, C0445x {
        String strA;
        int iC;
        if ((this.f8096b & 7) != 2) {
            throw C0446y.b();
        }
        do {
            J3.e eVar = (J3.e) this.f8099e;
            if (z8) {
                W(2);
                strA = eVar.B();
            } else {
                W(2);
                strA = eVar.A();
            }
            ((S) interfaceC0443v).add(strA);
            if (eVar.g()) {
                return;
            } else {
                iC = eVar.C();
            }
        } while (iC == this.f8096b);
        this.f8098d = iC;
    }

    public void N(List list, boolean z8) throws com.google.crypto.tink.shaded.protobuf.A, C0445x {
        String strA;
        int iC;
        int iC2;
        if ((this.f8096b & 7) != 2) {
            throw com.google.crypto.tink.shaded.protobuf.B.c();
        }
        boolean z9 = list instanceof com.google.crypto.tink.shaded.protobuf.E;
        J3.e eVar = (J3.e) this.f8099e;
        if (z9 && !z8) {
            com.google.crypto.tink.shaded.protobuf.E e8 = (com.google.crypto.tink.shaded.protobuf.E) list;
            do {
                e8.w(m());
                if (eVar.g()) {
                    return;
                } else {
                    iC2 = eVar.C();
                }
            } while (iC2 == this.f8096b);
            this.f8098d = iC2;
            return;
        }
        do {
            if (z8) {
                W(2);
                strA = eVar.B();
            } else {
                W(2);
                strA = eVar.A();
            }
            list.add(strA);
            if (eVar.g()) {
                return;
            } else {
                iC = eVar.C();
            }
        } while (iC == this.f8096b);
        this.f8098d = iC;
    }

    public void O(InterfaceC0443v interfaceC0443v) throws C0446y, com.google.crypto.tink.shaded.protobuf.B {
        int iC;
        int i = this.f8096b & 7;
        J3.e eVar = (J3.e) this.f8099e;
        if (i == 0) {
            do {
                ((S) interfaceC0443v).add(Integer.valueOf(eVar.D()));
                if (eVar.g()) {
                    return;
                } else {
                    iC = eVar.C();
                }
            } while (iC == this.f8096b);
            this.f8098d = iC;
            return;
        }
        if (i != 2) {
            throw C0446y.b();
        }
        int iF = eVar.f() + eVar.D();
        do {
            ((S) interfaceC0443v).add(Integer.valueOf(eVar.D()));
        } while (eVar.f() < iF);
        V(iF);
    }

    public void P(List list) throws C0446y, com.google.crypto.tink.shaded.protobuf.B {
        int iC;
        int iC2;
        boolean z8 = list instanceof AbstractC0756w;
        J3.e eVar = (J3.e) this.f8099e;
        if (!z8) {
            int i = this.f8096b & 7;
            if (i == 0) {
                do {
                    list.add(Integer.valueOf(eVar.D()));
                    if (eVar.g()) {
                        return;
                    } else {
                        iC = eVar.C();
                    }
                } while (iC == this.f8096b);
                this.f8098d = iC;
                return;
            }
            if (i != 2) {
                throw com.google.crypto.tink.shaded.protobuf.B.c();
            }
            int iF = eVar.f() + eVar.D();
            do {
                list.add(Integer.valueOf(eVar.D()));
            } while (eVar.f() < iF);
            V(iF);
            return;
        }
        AbstractC0756w abstractC0756w = (AbstractC0756w) list;
        int i5 = this.f8096b & 7;
        if (i5 == 0) {
            do {
                abstractC0756w.b(eVar.D());
                if (eVar.g()) {
                    return;
                } else {
                    iC2 = eVar.C();
                }
            } while (iC2 == this.f8096b);
            this.f8098d = iC2;
            return;
        }
        if (i5 != 2) {
            throw com.google.crypto.tink.shaded.protobuf.B.c();
        }
        int iF2 = eVar.f() + eVar.D();
        do {
            abstractC0756w.b(eVar.D());
        } while (eVar.f() < iF2);
        V(iF2);
    }

    public void Q(InterfaceC0443v interfaceC0443v) throws C0446y, com.google.crypto.tink.shaded.protobuf.B {
        int iC;
        int i = this.f8096b & 7;
        J3.e eVar = (J3.e) this.f8099e;
        if (i == 0) {
            do {
                ((S) interfaceC0443v).add(Long.valueOf(eVar.E()));
                if (eVar.g()) {
                    return;
                } else {
                    iC = eVar.C();
                }
            } while (iC == this.f8096b);
            this.f8098d = iC;
            return;
        }
        if (i != 2) {
            throw C0446y.b();
        }
        int iF = eVar.f() + eVar.D();
        do {
            ((S) interfaceC0443v).add(Long.valueOf(eVar.E()));
        } while (eVar.f() < iF);
        V(iF);
    }

    public void R(List list) throws C0446y, com.google.crypto.tink.shaded.protobuf.B {
        int iC;
        int iC2;
        boolean z8 = list instanceof com.google.crypto.tink.shaded.protobuf.I;
        J3.e eVar = (J3.e) this.f8099e;
        if (!z8) {
            int i = this.f8096b & 7;
            if (i == 0) {
                do {
                    list.add(Long.valueOf(eVar.E()));
                    if (eVar.g()) {
                        return;
                    } else {
                        iC = eVar.C();
                    }
                } while (iC == this.f8096b);
                this.f8098d = iC;
                return;
            }
            if (i != 2) {
                throw com.google.crypto.tink.shaded.protobuf.B.c();
            }
            int iF = eVar.f() + eVar.D();
            do {
                list.add(Long.valueOf(eVar.E()));
            } while (eVar.f() < iF);
            V(iF);
            return;
        }
        com.google.crypto.tink.shaded.protobuf.I i5 = (com.google.crypto.tink.shaded.protobuf.I) list;
        int i8 = this.f8096b & 7;
        if (i8 == 0) {
            do {
                i5.b(eVar.E());
                if (eVar.g()) {
                    return;
                } else {
                    iC2 = eVar.C();
                }
            } while (iC2 == this.f8096b);
            this.f8098d = iC2;
            return;
        }
        if (i8 != 2) {
            throw com.google.crypto.tink.shaded.protobuf.B.c();
        }
        int iF2 = eVar.f() + eVar.D();
        do {
            i5.b(eVar.E());
        } while (eVar.f() < iF2);
        V(iF2);
    }

    public long S() {
        int i = this.f8097c;
        if (i == 0) {
            throw new NoSuchElementException();
        }
        long[] jArr = (long[]) this.f8099e;
        int i5 = this.f8096b;
        long j8 = jArr[i5];
        this.f8096b = this.f8098d & (i5 + 1);
        this.f8097c = i - 1;
        return j8;
    }

    public void T(int i) {
        if (i <= 0) {
            return;
        }
        if (i > X()) {
            throw new ArrayIndexOutOfBoundsException();
        }
        int i5 = this.f8097c;
        int i8 = i < i5 ? i5 - i : 0;
        for (int i9 = i8; i9 < i5; i9++) {
            ((Object[]) this.f8099e)[i9] = null;
        }
        int i10 = this.f8097c;
        int i11 = i10 - i8;
        int i12 = i - i11;
        this.f8097c = i10 - i11;
        if (i12 > 0) {
            int length = ((Object[]) this.f8099e).length;
            this.f8097c = length;
            int i13 = length - i12;
            for (int i14 = i13; i14 < length; i14++) {
                ((Object[]) this.f8099e)[i14] = null;
            }
            this.f8097c = i13;
        }
    }

    public void U(int i) {
        if (i <= 0) {
            return;
        }
        if (i > X()) {
            throw new ArrayIndexOutOfBoundsException();
        }
        int length = ((Object[]) this.f8099e).length;
        int i5 = this.f8096b;
        if (i < length - i5) {
            length = i5 + i;
        }
        while (i5 < length) {
            ((Object[]) this.f8099e)[i5] = null;
            i5++;
        }
        int i8 = this.f8096b;
        int i9 = length - i8;
        int i10 = i - i9;
        this.f8096b = this.f8098d & (i8 + i9);
        if (i10 > 0) {
            for (int i11 = 0; i11 < i10; i11++) {
                ((Object[]) this.f8099e)[i11] = null;
            }
            this.f8096b = i10;
        }
    }

    public void V(int i) throws C0446y, com.google.crypto.tink.shaded.protobuf.B {
        switch (this.f8095a) {
            case u0.f15495q /* 0 */:
                if (((J3.e) this.f8099e).f() != i) {
                    throw C0446y.e();
                }
                return;
            default:
                if (((J3.e) this.f8099e).f() != i) {
                    throw com.google.crypto.tink.shaded.protobuf.B.g();
                }
                return;
        }
    }

    public void W(int i) throws com.google.crypto.tink.shaded.protobuf.A, C0445x {
        switch (this.f8095a) {
            case u0.f15495q /* 0 */:
                if ((this.f8096b & 7) != i) {
                    throw C0446y.b();
                }
                return;
            default:
                if ((this.f8096b & 7) != i) {
                    throw com.google.crypto.tink.shaded.protobuf.B.c();
                }
                return;
        }
    }

    public int X() {
        return (this.f8097c - this.f8096b) & this.f8098d;
    }

    public boolean Y() {
        int i;
        J3.e eVar = (J3.e) this.f8099e;
        if (eVar.g() || (i = this.f8096b) == this.f8097c) {
            return false;
        }
        return eVar.F(i);
    }

    public void a(C1400t c1400t) {
        c1400t.f15905s = null;
        c1400t.f15903q = null;
        c1400t.f15904r = null;
        c1400t.f15911y = 1;
        int i = this.f8096b;
        if (i > 0) {
            int i5 = this.f8098d;
            if ((i5 & 1) == 0) {
                this.f8098d = i5 + 1;
                this.f8096b = i - 1;
                this.f8097c++;
            }
        }
        c1400t.f15903q = (C1400t) this.f8099e;
        this.f8099e = c1400t;
        int i8 = this.f8098d;
        int i9 = i8 + 1;
        this.f8098d = i9;
        int i10 = this.f8096b;
        if (i10 > 0 && (i9 & 1) == 0) {
            this.f8098d = i8 + 2;
            this.f8096b = i10 - 1;
            this.f8097c++;
        }
        int i11 = 4;
        while (true) {
            int i12 = i11 - 1;
            if ((this.f8098d & i12) != i12) {
                return;
            }
            int i13 = this.f8097c;
            if (i13 == 0) {
                C1400t c1400t2 = (C1400t) this.f8099e;
                C1400t c1400t3 = c1400t2.f15903q;
                C1400t c1400t4 = c1400t3.f15903q;
                c1400t3.f15903q = c1400t4.f15903q;
                this.f8099e = c1400t3;
                c1400t3.f15904r = c1400t4;
                c1400t3.f15905s = c1400t2;
                c1400t3.f15911y = c1400t2.f15911y + 1;
                c1400t4.f15903q = c1400t3;
                c1400t2.f15903q = c1400t3;
            } else if (i13 == 1) {
                C1400t c1400t5 = (C1400t) this.f8099e;
                C1400t c1400t6 = c1400t5.f15903q;
                this.f8099e = c1400t6;
                c1400t6.f15905s = c1400t5;
                c1400t6.f15911y = c1400t5.f15911y + 1;
                c1400t5.f15903q = c1400t6;
                this.f8097c = 0;
            } else if (i13 == 2) {
                this.f8097c = 0;
            }
            i11 *= 2;
        }
    }

    public void b(Object obj) {
        Object[] objArr = (Object[]) this.f8099e;
        int i = this.f8097c;
        objArr[i] = obj;
        int i5 = this.f8098d & (i + 1);
        this.f8097c = i5;
        if (i5 == this.f8096b) {
            c();
        }
    }

    public void c() {
        Object[] objArr = (Object[]) this.f8099e;
        int length = objArr.length;
        int i = this.f8096b;
        int i5 = length - i;
        int i8 = length << 1;
        if (i8 < 0) {
            throw new RuntimeException("Max array capacity exceeded");
        }
        Object[] objArr2 = new Object[i8];
        B6.j.H(0, i, length, objArr, objArr2);
        B6.j.H(i5, 0, this.f8096b, (Object[]) this.f8099e, objArr2);
        this.f8099e = objArr2;
        this.f8096b = 0;
        this.f8097c = length;
        this.f8098d = i8 - 1;
    }

    public Object d(int i) {
        if (i < 0 || i >= X()) {
            throw new ArrayIndexOutOfBoundsException();
        }
        Object obj = ((Object[]) this.f8099e)[this.f8098d & (this.f8096b + i)];
        P6.g.b(obj);
        return obj;
    }

    public int e() {
        switch (this.f8095a) {
            case u0.f15495q /* 0 */:
                int i = this.f8098d;
                if (i != 0) {
                    this.f8096b = i;
                    this.f8098d = 0;
                } else {
                    this.f8096b = ((J3.e) this.f8099e).C();
                }
                int i5 = this.f8096b;
                if (i5 == 0 || i5 == this.f8097c) {
                    return Integer.MAX_VALUE;
                }
                return i5 >>> 3;
            default:
                int i8 = this.f8098d;
                if (i8 != 0) {
                    this.f8096b = i8;
                    this.f8098d = 0;
                } else {
                    this.f8096b = ((J3.e) this.f8099e).C();
                }
                int i9 = this.f8096b;
                if (i9 == 0 || i9 == this.f8097c) {
                    return Integer.MAX_VALUE;
                }
                return i9 >>> 3;
        }
    }

    public void f(Object obj, U u8, C0435m c0435m) {
        int i = this.f8097c;
        this.f8097c = ((this.f8096b >>> 3) << 3) | 4;
        try {
            u8.f(obj, this, c0435m);
            if (this.f8096b == this.f8097c) {
            } else {
                throw new C0446y("Failed to parse the message.");
            }
        } finally {
            this.f8097c = i;
        }
    }

    public void g(Object obj, com.google.crypto.tink.shaded.protobuf.b0 b0Var, C0748n c0748n) {
        int i = this.f8097c;
        this.f8097c = ((this.f8096b >>> 3) << 3) | 4;
        try {
            b0Var.j(obj, this, c0748n);
            if (this.f8096b == this.f8097c) {
            } else {
                throw com.google.crypto.tink.shaded.protobuf.B.f();
            }
        } finally {
            this.f8097c = i;
        }
    }

    public void h(Object obj, U u8, C0435m c0435m) throws C0446y {
        J3.e eVar = (J3.e) this.f8099e;
        int iD = eVar.D();
        if (eVar.f3473a >= 100) {
            throw new C0446y("Protocol message had too many levels of nesting.  May be malicious.  Use setRecursionLimit() to increase the recursion depth limit.");
        }
        int iL = eVar.l(iD);
        eVar.f3473a++;
        u8.f(obj, this, c0435m);
        eVar.b(0);
        eVar.f3473a--;
        eVar.j(iL);
    }

    public void i(Object obj, com.google.crypto.tink.shaded.protobuf.b0 b0Var, C0748n c0748n) throws com.google.crypto.tink.shaded.protobuf.B {
        J3.e eVar = (J3.e) this.f8099e;
        int iD = eVar.D();
        if (eVar.f3473a >= 100) {
            throw new com.google.crypto.tink.shaded.protobuf.B("Protocol message had too many levels of nesting.  May be malicious.  Use CodedInputStream.setRecursionLimit() to increase the depth limit.");
        }
        int iL = eVar.l(iD);
        eVar.f3473a++;
        b0Var.j(obj, this, c0748n);
        eVar.b(0);
        eVar.f3473a--;
        eVar.j(iL);
    }

    public void j(InterfaceC0443v interfaceC0443v) throws C0446y, com.google.crypto.tink.shaded.protobuf.B {
        int iC;
        int i = this.f8096b & 7;
        J3.e eVar = (J3.e) this.f8099e;
        if (i == 0) {
            do {
                ((S) interfaceC0443v).add(Boolean.valueOf(eVar.m()));
                if (eVar.g()) {
                    return;
                } else {
                    iC = eVar.C();
                }
            } while (iC == this.f8096b);
            this.f8098d = iC;
            return;
        }
        if (i != 2) {
            throw C0446y.b();
        }
        int iF = eVar.f() + eVar.D();
        do {
            ((S) interfaceC0443v).add(Boolean.valueOf(eVar.m()));
        } while (eVar.f() < iF);
        V(iF);
    }

    public void k(List list) throws C0446y, com.google.crypto.tink.shaded.protobuf.B {
        int iC;
        int iC2;
        boolean z8 = list instanceof AbstractC0738d;
        J3.e eVar = (J3.e) this.f8099e;
        if (!z8) {
            int i = this.f8096b & 7;
            if (i == 0) {
                do {
                    list.add(Boolean.valueOf(eVar.m()));
                    if (eVar.g()) {
                        return;
                    } else {
                        iC = eVar.C();
                    }
                } while (iC == this.f8096b);
                this.f8098d = iC;
                return;
            }
            if (i != 2) {
                throw com.google.crypto.tink.shaded.protobuf.B.c();
            }
            int iF = eVar.f() + eVar.D();
            do {
                list.add(Boolean.valueOf(eVar.m()));
            } while (eVar.f() < iF);
            V(iF);
            return;
        }
        AbstractC0738d abstractC0738d = (AbstractC0738d) list;
        int i5 = this.f8096b & 7;
        if (i5 == 0) {
            do {
                abstractC0738d.b(eVar.m());
                if (eVar.g()) {
                    return;
                } else {
                    iC2 = eVar.C();
                }
            } while (iC2 == this.f8096b);
            this.f8098d = iC2;
            return;
        }
        if (i5 != 2) {
            throw com.google.crypto.tink.shaded.protobuf.B.c();
        }
        int iF2 = eVar.f() + eVar.D();
        do {
            abstractC0738d.b(eVar.m());
        } while (eVar.f() < iF2);
        V(iF2);
    }

    public C0429g l() throws com.google.crypto.tink.shaded.protobuf.A, C0445x {
        W(2);
        return ((J3.e) this.f8099e).n();
    }

    public AbstractC0742h m() throws com.google.crypto.tink.shaded.protobuf.A, C0445x {
        W(2);
        return ((J3.e) this.f8099e).o();
    }

    public void n(InterfaceC0443v interfaceC0443v) throws C0445x {
        int iC;
        if ((this.f8096b & 7) != 2) {
            throw C0446y.b();
        }
        do {
            ((S) interfaceC0443v).add(l());
            J3.e eVar = (J3.e) this.f8099e;
            if (eVar.g()) {
                return;
            } else {
                iC = eVar.C();
            }
        } while (iC == this.f8096b);
        this.f8098d = iC;
    }

    public void o(List list) throws com.google.crypto.tink.shaded.protobuf.A {
        int iC;
        if ((this.f8096b & 7) != 2) {
            throw com.google.crypto.tink.shaded.protobuf.B.c();
        }
        do {
            list.add(m());
            J3.e eVar = (J3.e) this.f8099e;
            if (eVar.g()) {
                return;
            } else {
                iC = eVar.C();
            }
        } while (iC == this.f8096b);
        this.f8098d = iC;
    }

    public void p(InterfaceC0443v interfaceC0443v) throws C0446y {
        int iC;
        int i = this.f8096b & 7;
        J3.e eVar = (J3.e) this.f8099e;
        if (i == 1) {
            do {
                ((S) interfaceC0443v).add(Double.valueOf(eVar.p()));
                if (eVar.g()) {
                    return;
                } else {
                    iC = eVar.C();
                }
            } while (iC == this.f8096b);
            this.f8098d = iC;
            return;
        }
        if (i != 2) {
            throw C0446y.b();
        }
        int iD = eVar.D();
        if ((iD & 7) != 0) {
            throw new C0446y("Failed to parse the message.");
        }
        int iF = eVar.f() + iD;
        do {
            ((S) interfaceC0443v).add(Double.valueOf(eVar.p()));
        } while (eVar.f() < iF);
    }

    public void q(List list) throws com.google.crypto.tink.shaded.protobuf.B {
        int iC;
        int iC2;
        boolean z8 = list instanceof AbstractC0746l;
        J3.e eVar = (J3.e) this.f8099e;
        if (!z8) {
            int i = this.f8096b & 7;
            if (i == 1) {
                do {
                    list.add(Double.valueOf(eVar.p()));
                    if (eVar.g()) {
                        return;
                    } else {
                        iC = eVar.C();
                    }
                } while (iC == this.f8096b);
                this.f8098d = iC;
                return;
            }
            if (i != 2) {
                throw com.google.crypto.tink.shaded.protobuf.B.c();
            }
            int iD = eVar.D();
            a0(iD);
            int iF = eVar.f() + iD;
            do {
                list.add(Double.valueOf(eVar.p()));
            } while (eVar.f() < iF);
            return;
        }
        AbstractC0746l abstractC0746l = (AbstractC0746l) list;
        int i5 = this.f8096b & 7;
        if (i5 == 1) {
            do {
                abstractC0746l.b(eVar.p());
                if (eVar.g()) {
                    return;
                } else {
                    iC2 = eVar.C();
                }
            } while (iC2 == this.f8096b);
            this.f8098d = iC2;
            return;
        }
        if (i5 != 2) {
            throw com.google.crypto.tink.shaded.protobuf.B.c();
        }
        int iD2 = eVar.D();
        a0(iD2);
        int iF2 = eVar.f() + iD2;
        do {
            abstractC0746l.b(eVar.p());
        } while (eVar.f() < iF2);
    }

    public void r(InterfaceC0443v interfaceC0443v) throws C0446y, com.google.crypto.tink.shaded.protobuf.B {
        int iC;
        int i = this.f8096b & 7;
        J3.e eVar = (J3.e) this.f8099e;
        if (i == 0) {
            do {
                ((S) interfaceC0443v).add(Integer.valueOf(eVar.q()));
                if (eVar.g()) {
                    return;
                } else {
                    iC = eVar.C();
                }
            } while (iC == this.f8096b);
            this.f8098d = iC;
            return;
        }
        if (i != 2) {
            throw C0446y.b();
        }
        int iF = eVar.f() + eVar.D();
        do {
            ((S) interfaceC0443v).add(Integer.valueOf(eVar.q()));
        } while (eVar.f() < iF);
        V(iF);
    }

    public void s(List list) throws C0446y, com.google.crypto.tink.shaded.protobuf.B {
        int iC;
        int iC2;
        boolean z8 = list instanceof AbstractC0756w;
        J3.e eVar = (J3.e) this.f8099e;
        if (!z8) {
            int i = this.f8096b & 7;
            if (i == 0) {
                do {
                    list.add(Integer.valueOf(eVar.q()));
                    if (eVar.g()) {
                        return;
                    } else {
                        iC = eVar.C();
                    }
                } while (iC == this.f8096b);
                this.f8098d = iC;
                return;
            }
            if (i != 2) {
                throw com.google.crypto.tink.shaded.protobuf.B.c();
            }
            int iF = eVar.f() + eVar.D();
            do {
                list.add(Integer.valueOf(eVar.q()));
            } while (eVar.f() < iF);
            V(iF);
            return;
        }
        AbstractC0756w abstractC0756w = (AbstractC0756w) list;
        int i5 = this.f8096b & 7;
        if (i5 == 0) {
            do {
                abstractC0756w.b(eVar.q());
                if (eVar.g()) {
                    return;
                } else {
                    iC2 = eVar.C();
                }
            } while (iC2 == this.f8096b);
            this.f8098d = iC2;
            return;
        }
        if (i5 != 2) {
            throw com.google.crypto.tink.shaded.protobuf.B.c();
        }
        int iF2 = eVar.f() + eVar.D();
        do {
            abstractC0756w.b(eVar.q());
        } while (eVar.f() < iF2);
        V(iF2);
    }

    public Object t(p0 p0Var, Class cls, C0435m c0435m) throws C0446y, com.google.crypto.tink.shaded.protobuf.A {
        int iOrdinal = p0Var.ordinal();
        J3.e eVar = (J3.e) this.f8099e;
        switch (iOrdinal) {
            case u0.f15495q /* 0 */:
                W(1);
                return Double.valueOf(eVar.p());
            case 1:
                W(5);
                return Float.valueOf(eVar.t());
            case 2:
                W(0);
                return Long.valueOf(eVar.v());
            case 3:
                W(0);
                return Long.valueOf(eVar.E());
            case 4:
                W(0);
                return Integer.valueOf(eVar.u());
            case 5:
                W(1);
                return Long.valueOf(eVar.s());
            case Z.g.STRING_SET_FIELD_NUMBER /* 6 */:
                W(5);
                return Integer.valueOf(eVar.r());
            case Z.g.DOUBLE_FIELD_NUMBER /* 7 */:
                W(0);
                return Boolean.valueOf(eVar.m());
            case Z.g.BYTES_FIELD_NUMBER /* 8 */:
                W(2);
                return eVar.B();
            case 9:
            default:
                throw new IllegalArgumentException("unsupported field type.");
            case 10:
                W(2);
                U uA = Q.f8024c.a(cls);
                AbstractC0442u abstractC0442uC = uA.c();
                h(abstractC0442uC, uA, c0435m);
                uA.d(abstractC0442uC);
                return abstractC0442uC;
            case 11:
                return l();
            case 12:
                W(0);
                return Integer.valueOf(eVar.D());
            case 13:
                W(0);
                return Integer.valueOf(eVar.q());
            case 14:
                W(5);
                return Integer.valueOf(eVar.w());
            case 15:
                W(1);
                return Long.valueOf(eVar.x());
            case 16:
                W(0);
                return Integer.valueOf(eVar.y());
            case 17:
                W(0);
                return Long.valueOf(eVar.z());
        }
    }

    public void u(InterfaceC0443v interfaceC0443v) throws C0446y {
        int iC;
        int i = this.f8096b & 7;
        J3.e eVar = (J3.e) this.f8099e;
        if (i == 2) {
            int iD = eVar.D();
            if ((iD & 3) != 0) {
                throw new C0446y("Failed to parse the message.");
            }
            int iF = eVar.f() + iD;
            do {
                ((S) interfaceC0443v).add(Integer.valueOf(eVar.r()));
            } while (eVar.f() < iF);
            return;
        }
        if (i != 5) {
            throw C0446y.b();
        }
        do {
            ((S) interfaceC0443v).add(Integer.valueOf(eVar.r()));
            if (eVar.g()) {
                return;
            } else {
                iC = eVar.C();
            }
        } while (iC == this.f8096b);
        this.f8098d = iC;
    }

    public void v(List list) throws com.google.crypto.tink.shaded.protobuf.B {
        int iC;
        int iC2;
        boolean z8 = list instanceof AbstractC0756w;
        J3.e eVar = (J3.e) this.f8099e;
        if (!z8) {
            int i = this.f8096b & 7;
            if (i == 2) {
                int iD = eVar.D();
                Z(iD);
                int iF = eVar.f() + iD;
                do {
                    list.add(Integer.valueOf(eVar.r()));
                } while (eVar.f() < iF);
                return;
            }
            if (i != 5) {
                throw com.google.crypto.tink.shaded.protobuf.B.c();
            }
            do {
                list.add(Integer.valueOf(eVar.r()));
                if (eVar.g()) {
                    return;
                } else {
                    iC = eVar.C();
                }
            } while (iC == this.f8096b);
            this.f8098d = iC;
            return;
        }
        AbstractC0756w abstractC0756w = (AbstractC0756w) list;
        int i5 = this.f8096b & 7;
        if (i5 == 2) {
            int iD2 = eVar.D();
            Z(iD2);
            int iF2 = eVar.f() + iD2;
            do {
                abstractC0756w.b(eVar.r());
            } while (eVar.f() < iF2);
            return;
        }
        if (i5 != 5) {
            throw com.google.crypto.tink.shaded.protobuf.B.c();
        }
        do {
            abstractC0756w.b(eVar.r());
            if (eVar.g()) {
                return;
            } else {
                iC2 = eVar.C();
            }
        } while (iC2 == this.f8096b);
        this.f8098d = iC2;
    }

    public void w(InterfaceC0443v interfaceC0443v) throws C0446y {
        int iC;
        int i = this.f8096b & 7;
        J3.e eVar = (J3.e) this.f8099e;
        if (i == 1) {
            do {
                ((S) interfaceC0443v).add(Long.valueOf(eVar.s()));
                if (eVar.g()) {
                    return;
                } else {
                    iC = eVar.C();
                }
            } while (iC == this.f8096b);
            this.f8098d = iC;
            return;
        }
        if (i != 2) {
            throw C0446y.b();
        }
        int iD = eVar.D();
        if ((iD & 7) != 0) {
            throw new C0446y("Failed to parse the message.");
        }
        int iF = eVar.f() + iD;
        do {
            ((S) interfaceC0443v).add(Long.valueOf(eVar.s()));
        } while (eVar.f() < iF);
    }

    public void x(List list) throws com.google.crypto.tink.shaded.protobuf.B {
        int iC;
        int iC2;
        boolean z8 = list instanceof com.google.crypto.tink.shaded.protobuf.I;
        J3.e eVar = (J3.e) this.f8099e;
        if (!z8) {
            int i = this.f8096b & 7;
            if (i == 1) {
                do {
                    list.add(Long.valueOf(eVar.s()));
                    if (eVar.g()) {
                        return;
                    } else {
                        iC = eVar.C();
                    }
                } while (iC == this.f8096b);
                this.f8098d = iC;
                return;
            }
            if (i != 2) {
                throw com.google.crypto.tink.shaded.protobuf.B.c();
            }
            int iD = eVar.D();
            a0(iD);
            int iF = eVar.f() + iD;
            do {
                list.add(Long.valueOf(eVar.s()));
            } while (eVar.f() < iF);
            return;
        }
        com.google.crypto.tink.shaded.protobuf.I i5 = (com.google.crypto.tink.shaded.protobuf.I) list;
        int i8 = this.f8096b & 7;
        if (i8 == 1) {
            do {
                i5.b(eVar.s());
                if (eVar.g()) {
                    return;
                } else {
                    iC2 = eVar.C();
                }
            } while (iC2 == this.f8096b);
            this.f8098d = iC2;
            return;
        }
        if (i8 != 2) {
            throw com.google.crypto.tink.shaded.protobuf.B.c();
        }
        int iD2 = eVar.D();
        a0(iD2);
        int iF2 = eVar.f() + iD2;
        do {
            i5.b(eVar.s());
        } while (eVar.f() < iF2);
    }

    public void y(InterfaceC0443v interfaceC0443v) throws C0446y {
        int iC;
        int i = this.f8096b & 7;
        J3.e eVar = (J3.e) this.f8099e;
        if (i == 2) {
            int iD = eVar.D();
            if ((iD & 3) != 0) {
                throw new C0446y("Failed to parse the message.");
            }
            int iF = eVar.f() + iD;
            do {
                ((S) interfaceC0443v).add(Float.valueOf(eVar.t()));
            } while (eVar.f() < iF);
            return;
        }
        if (i != 5) {
            throw C0446y.b();
        }
        do {
            ((S) interfaceC0443v).add(Float.valueOf(eVar.t()));
            if (eVar.g()) {
                return;
            } else {
                iC = eVar.C();
            }
        } while (iC == this.f8096b);
        this.f8098d = iC;
    }

    public void z(List list) throws com.google.crypto.tink.shaded.protobuf.B {
        int iC;
        int iC2;
        boolean z8 = list instanceof com.google.crypto.tink.shaded.protobuf.r;
        J3.e eVar = (J3.e) this.f8099e;
        if (!z8) {
            int i = this.f8096b & 7;
            if (i == 2) {
                int iD = eVar.D();
                Z(iD);
                int iF = eVar.f() + iD;
                do {
                    list.add(Float.valueOf(eVar.t()));
                } while (eVar.f() < iF);
                return;
            }
            if (i != 5) {
                throw com.google.crypto.tink.shaded.protobuf.B.c();
            }
            do {
                list.add(Float.valueOf(eVar.t()));
                if (eVar.g()) {
                    return;
                } else {
                    iC = eVar.C();
                }
            } while (iC == this.f8096b);
            this.f8098d = iC;
            return;
        }
        com.google.crypto.tink.shaded.protobuf.r rVar = (com.google.crypto.tink.shaded.protobuf.r) list;
        int i5 = this.f8096b & 7;
        if (i5 == 2) {
            int iD2 = eVar.D();
            Z(iD2);
            int iF2 = eVar.f() + iD2;
            do {
                rVar.b(eVar.t());
            } while (eVar.f() < iF2);
            return;
        }
        if (i5 != 5) {
            throw com.google.crypto.tink.shaded.protobuf.B.c();
        }
        do {
            rVar.b(eVar.t());
            if (eVar.g()) {
                return;
            } else {
                iC2 = eVar.C();
            }
        } while (iC2 == this.f8096b);
        this.f8098d = iC2;
    }

    public C0432j(int i) {
        this.f8095a = 3;
        if (!(i >= 1)) {
            AbstractC1481a.c("capacity must be >= 1");
            throw null;
        }
        if (!(i <= 1073741824)) {
            AbstractC1481a.c("capacity must be <= 2^30");
            throw null;
        }
        i = Integer.bitCount(i) != 1 ? Integer.highestOneBit(i - 1) << 1 : i;
        this.f8098d = i - 1;
        this.f8099e = new Object[i];
    }

    public C0432j(J3.e eVar) {
        this.f8095a = 0;
        this.f8098d = 0;
        Charset charset = AbstractC0444w.f8140a;
        this.f8099e = eVar;
        eVar.f3474b = this;
    }

    public C0432j(J3.e eVar, byte b8) {
        this.f8095a = 1;
        this.f8098d = 0;
        AbstractC0759z.a(eVar, "input");
        this.f8099e = eVar;
        eVar.f3474b = this;
    }
}
