package o;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* loaded from: classes.dex */
public final class Qh0 {
    public static Ph0 a(Object obj) {
        DD dd = (DD) obj;
        Ph0 ph0 = dd.unknownFields;
        if (ph0 != Ph0.f) {
            return ph0;
        }
        Ph0 ph02 = new Ph0(0, new int[8], new Object[8], true);
        dd.unknownFields = ph02;
        return ph02;
    }

    public static boolean b(int i, Object obj, C2642ui c2642ui) throws EI {
        int i2 = c2642ui.b;
        AbstractC2071oh abstractC2071oh = (AbstractC2071oh) c2642ui.e;
        int i3 = i2 >>> 3;
        int i4 = i2 & 7;
        if (i4 == 0) {
            c2642ui.C(0);
            ((Ph0) obj).c(i3 << 3, Long.valueOf(abstractC2071oh.s()));
            return true;
        }
        if (i4 == 1) {
            c2642ui.C(1);
            ((Ph0) obj).c((i3 << 3) | 1, Long.valueOf(abstractC2071oh.p()));
            return true;
        }
        if (i4 == 2) {
            ((Ph0) obj).c((i3 << 3) | 2, c2642ui.k());
            return true;
        }
        if (i4 != 3) {
            if (i4 == 4) {
                return false;
            }
            if (i4 != 5) {
                throw EI.b();
            }
            c2642ui.C(5);
            ((Ph0) obj).c(5 | (i3 << 3), Integer.valueOf(abstractC2071oh.o()));
            return true;
        }
        Ph0 ph0 = new Ph0(0, new int[8], new Object[8], true);
        int i5 = i3 << 3;
        int i6 = i5 | 4;
        int i7 = i + 1;
        if (i7 >= 100) {
            throw new EI("Protocol message had too many levels of nesting.  May be malicious.  Use setRecursionLimit() to increase the recursion depth limit.");
        }
        while (c2642ui.e() != Integer.MAX_VALUE && b(i7, ph0, c2642ui)) {
        }
        if (i6 != c2642ui.b) {
            throw new EI("Protocol message end-group tag did not match expected tag.");
        }
        if (ph0.e) {
            ph0.e = false;
        }
        ((Ph0) obj).c(i5 | 3, ph0);
        return true;
    }
}
