package com.google.crypto.tink.shaded.protobuf;

import defpackage.AbstractC0715;
import defpackage.AbstractC2202;
import defpackage.AbstractC2990;
import defpackage.AbstractC3306;
import defpackage.AbstractC3815;
import defpackage.AbstractC4467;
import defpackage.C0321;
import defpackage.C1260;
import defpackage.C1523;
import defpackage.C2931;
import defpackage.C4572;
import defpackage.C4718;
import defpackage.C5500;
import defpackage.InterfaceC0380;
import defpackage.InterfaceC4538;
import j$.util.concurrent.ConcurrentHashMap;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Map;

/* renamed from: com.google.crypto.tink.shaded.protobuf.ˇʼʤˎ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public abstract class AbstractC0018 extends AbstractC0024 {
    private static final int MEMOIZED_SERIALIZED_SIZE_MASK = Integer.MAX_VALUE;
    private static final int MUTABLE_FLAG_MASK = Integer.MIN_VALUE;
    static final int UNINITIALIZED_HASH_CODE = 0;
    static final int UNINITIALIZED_SERIALIZED_SIZE = Integer.MAX_VALUE;
    private static Map<Class<?>, AbstractC0018> defaultInstanceMap = new ConcurrentHashMap();
    private int memoizedSerializedSize;
    protected C0027 unknownFields;

    public AbstractC0018() {
        this.memoizedHashCode = UNINITIALIZED_HASH_CODE;
        this.memoizedSerializedSize = -1;
        this.unknownFields = C0027.f1105;
    }

    /* renamed from: ˑᵱ, reason: contains not printable characters */
    public static AbstractC0018 m841(AbstractC0018 abstractC0018, byte[] bArr, C1523 c1523) throws InvalidProtocolBufferException {
        int length = bArr.length;
        if (length != 0) {
            AbstractC0018 abstractC0018M853 = abstractC0018.m853();
            try {
                C4718 c4718 = C4718.f17421;
                c4718.getClass();
                InterfaceC4538 interfaceC4538M9905 = c4718.m9905(abstractC0018M853.getClass());
                C4572 c4572 = new C4572();
                c1523.getClass();
                interfaceC4538M9905.mo902(abstractC0018M853, bArr, UNINITIALIZED_HASH_CODE, length, c4572);
                interfaceC4538M9905.mo900(abstractC0018M853);
                abstractC0018 = abstractC0018M853;
            } catch (InvalidProtocolBufferException e) {
                if (e.f1070) {
                    throw new InvalidProtocolBufferException(e.getMessage(), e);
                }
                throw e;
            } catch (UninitializedMessageException e2) {
                throw new InvalidProtocolBufferException(e2.getMessage());
            } catch (IOException e3) {
                if (e3.getCause() instanceof InvalidProtocolBufferException) {
                    throw ((InvalidProtocolBufferException) e3.getCause());
                }
                throw new InvalidProtocolBufferException(e3.getMessage(), e3);
            } catch (IndexOutOfBoundsException unused) {
                throw InvalidProtocolBufferException.m835();
            }
        }
        m848(abstractC0018);
        return abstractC0018;
    }

    /* renamed from: ᵢˇᵭ, reason: contains not printable characters */
    public static void m842(Class cls, AbstractC0018 abstractC0018) {
        abstractC0018.m854();
        defaultInstanceMap.put(cls, abstractC0018);
    }

    /* renamed from: ᵧᵾˀˈ, reason: contains not printable characters */
    public static AbstractC0018 m843(AbstractC0018 abstractC0018, AbstractC0715 abstractC0715, C1523 c1523) throws InvalidProtocolBufferException {
        AbstractC0018 abstractC0018M853 = abstractC0018.m853();
        try {
            C4718 c4718 = C4718.f17421;
            c4718.getClass();
            InterfaceC4538 interfaceC4538M9905 = c4718.m9905(abstractC0018M853.getClass());
            C0029 c0029 = (C0029) abstractC0715.f3452;
            if (c0029 == null) {
                c0029 = new C0029(abstractC0715);
            }
            interfaceC4538M9905.mo874(abstractC0018M853, c0029, c1523);
            interfaceC4538M9905.mo900(abstractC0018M853);
            return abstractC0018M853;
        } catch (InvalidProtocolBufferException e) {
            if (e.f1070) {
                throw new InvalidProtocolBufferException(e.getMessage(), e);
            }
            throw e;
        } catch (UninitializedMessageException e2) {
            throw new InvalidProtocolBufferException(e2.getMessage());
        } catch (IOException e3) {
            if (e3.getCause() instanceof InvalidProtocolBufferException) {
                throw ((InvalidProtocolBufferException) e3.getCause());
            }
            throw new InvalidProtocolBufferException(e3.getMessage(), e3);
        } catch (RuntimeException e4) {
            if (e4.getCause() instanceof InvalidProtocolBufferException) {
                throw ((InvalidProtocolBufferException) e4.getCause());
            }
            throw e4;
        }
    }

    /* renamed from: ᵨᵳʝ, reason: contains not printable characters */
    public static AbstractC0018 m844(AbstractC0018 abstractC0018, AbstractC2202 abstractC2202, C1523 c1523) throws InvalidProtocolBufferException {
        C5500 c5500 = (C5500) abstractC2202;
        C0025 c0025M2712 = AbstractC0715.m2712(c5500.f20630, c5500.mo3599(), c5500.size(), true);
        AbstractC0018 abstractC0018M843 = m843(abstractC0018, c0025M2712, c1523);
        c0025M2712.mo182(UNINITIALIZED_HASH_CODE);
        m848(abstractC0018M843);
        return abstractC0018M843;
    }

    /* renamed from: ᵪʩ, reason: contains not printable characters */
    public static Object m845(Method method, AbstractC0018 abstractC0018, Object... objArr) {
        try {
            return method.invoke(abstractC0018, objArr);
        } catch (IllegalAccessException e) {
            ᵨᴵᵺ.ᵪʩ("Couldn't use Java reflection to implement protocol message reflection.", e);
            return null;
        } catch (InvocationTargetException e2) {
            Throwable cause = e2.getCause();
            if (cause instanceof RuntimeException) {
                throw ((RuntimeException) cause);
            }
            if (cause instanceof Error) {
                throw ((Error) cause);
            }
            ᵨᴵᵺ.ᵪʩ("Unexpected exception thrown by generated accessor method.", cause);
            return null;
        }
    }

    /* renamed from: ᵳٴᵶ, reason: contains not printable characters */
    public static final boolean m846(AbstractC0018 abstractC0018, boolean z) {
        byte bByteValue = ((Byte) abstractC0018.mo858(1)).byteValue();
        if (bByteValue == 1) {
            return true;
        }
        if (bByteValue == 0) {
            return false;
        }
        C4718 c4718 = C4718.f17421;
        c4718.getClass();
        boolean zMo881 = c4718.m9905(abstractC0018.getClass()).mo881(abstractC0018);
        if (z) {
            abstractC0018.mo858(2);
        }
        return zMo881;
    }

    /* renamed from: ᵸˑ, reason: contains not printable characters */
    public static AbstractC0018 m847(Class cls) throws ClassNotFoundException {
        AbstractC0018 abstractC0018 = defaultInstanceMap.get(cls);
        if (abstractC0018 == null) {
            try {
                Class.forName(cls.getName(), true, cls.getClassLoader());
                abstractC0018 = defaultInstanceMap.get(cls);
            } catch (ClassNotFoundException e) {
                C1260.m3810("Class initialization cannot fail.", e);
                return null;
            }
        }
        if (abstractC0018 != null) {
            return abstractC0018;
        }
        AbstractC0018 abstractC0018Mo857 = ((AbstractC0018) AbstractC4467.m9506(cls)).mo857();
        if (abstractC0018Mo857 != null) {
            defaultInstanceMap.put(cls, abstractC0018Mo857);
            return abstractC0018Mo857;
        }
        ᵨᴵᵺ.ˌʾˀ();
        return null;
    }

    /* renamed from: ᵹᵝᵶ, reason: contains not printable characters */
    public static void m848(AbstractC0018 abstractC0018) throws InvalidProtocolBufferException {
        if (abstractC0018 != null && !m846(abstractC0018, true)) {
            throw new InvalidProtocolBufferException(new UninitializedMessageException().getMessage());
        }
    }

    public final boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null || getClass() != obj.getClass()) {
            return false;
        }
        C4718 c4718 = C4718.f17421;
        c4718.getClass();
        return c4718.m9905(getClass()).mo880(this, (AbstractC0018) obj);
    }

    public final int hashCode() {
        if (m849()) {
            C4718 c4718 = C4718.f17421;
            c4718.getClass();
            return c4718.m9905(getClass()).mo878(this);
        }
        if (this.memoizedHashCode == 0) {
            C4718 c47182 = C4718.f17421;
            c47182.getClass();
            this.memoizedHashCode = c47182.m9905(getClass()).mo878(this);
        }
        return this.memoizedHashCode;
    }

    public final String toString() throws SecurityException {
        String string = super.toString();
        char[] cArr = AbstractC0021.f1086;
        StringBuilder sb = new StringBuilder();
        sb.append("# ");
        sb.append(string);
        AbstractC0021.m910(this, sb, UNINITIALIZED_HASH_CODE);
        return sb.toString();
    }

    /* renamed from: ˌʾˀ, reason: contains not printable characters */
    public final boolean m849() {
        return (this.memoizedSerializedSize & MUTABLE_FLAG_MASK) != 0;
    }

    @Override // defpackage.InterfaceC0420
    /* renamed from: ˌᵜᵹᵩ, reason: contains not printable characters and merged with bridge method [inline-methods] */
    public final AbstractC0018 mo857() {
        return (AbstractC0018) mo858(6);
    }

    @Override // com.google.crypto.tink.shaded.protobuf.AbstractC0024
    /* renamed from: ˎˏʜʾ, reason: contains not printable characters */
    public final void mo851(C0321 c0321) {
        C4718 c4718 = C4718.f17421;
        c4718.getClass();
        InterfaceC4538 interfaceC4538M9905 = c4718.m9905(getClass());
        C2931 c2931 = c0321.f1984;
        if (c2931 == null) {
            c2931 = new C2931();
            AbstractC3306.m7696(c0321, "output");
            c2931.f11366 = c0321;
            c0321.f1984 = c2931;
        }
        interfaceC4538M9905.mo888(this, c2931);
    }

    /* renamed from: ᵝᵵᵺ, reason: contains not printable characters */
    public final AbstractC3815 m852() {
        return (AbstractC3815) mo858(5);
    }

    /* renamed from: ᵞʡ, reason: contains not printable characters */
    public final AbstractC0018 m853() {
        return (AbstractC0018) mo858(4);
    }

    /* renamed from: ᵡʠ, reason: contains not printable characters */
    public final void m854() {
        this.memoizedSerializedSize &= Integer.MAX_VALUE;
    }

    @Override // com.google.crypto.tink.shaded.protobuf.AbstractC0024
    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public final int mo855(InterfaceC4538 interfaceC4538) {
        int iMo905;
        int iMo9052;
        if (m849()) {
            if (interfaceC4538 == null) {
                C4718 c4718 = C4718.f17421;
                c4718.getClass();
                iMo9052 = c4718.m9905(getClass()).mo905(this);
            } else {
                iMo9052 = interfaceC4538.mo905(this);
            }
            if (iMo9052 >= 0) {
                return iMo9052;
            }
            ᵹˉᵞ.ᵳٴᵶ(AbstractC2990.m7313(iMo9052, "serialized size must be non-negative, was "));
            return UNINITIALIZED_HASH_CODE;
        }
        int i = this.memoizedSerializedSize;
        if ((i & Integer.MAX_VALUE) != Integer.MAX_VALUE) {
            return i & Integer.MAX_VALUE;
        }
        if (interfaceC4538 == null) {
            C4718 c47182 = C4718.f17421;
            c47182.getClass();
            iMo905 = c47182.m9905(getClass()).mo905(this);
        } else {
            iMo905 = interfaceC4538.mo905(this);
        }
        m862(iMo905);
        return iMo905;
    }

    /* renamed from: ᵯٴᵦ, reason: contains not printable characters */
    public final InterfaceC0380 m856() {
        return (InterfaceC0380) mo858(7);
    }

    /* renamed from: ᵶᵷᵕ, reason: contains not printable characters */
    public abstract Object mo858(int i);

    @Override // com.google.crypto.tink.shaded.protobuf.AbstractC0024
    /* renamed from: ᵸʓᵠ, reason: contains not printable characters and merged with bridge method [inline-methods] */
    public final AbstractC3815 mo860() {
        return (AbstractC3815) mo858(5);
    }

    /* renamed from: ᵾᵬ, reason: contains not printable characters */
    public final AbstractC3815 m861() {
        AbstractC3815 abstractC3815 = (AbstractC3815) mo858(5);
        abstractC3815.m8458(this);
        return abstractC3815;
    }

    /* renamed from: ᵿʗᵝʽ, reason: contains not printable characters */
    public final void m862(int i) {
        if (i < 0) {
            ᵹˉᵞ.ᵳٴᵶ(AbstractC2990.m7313(i, "serialized size must be non-negative, was "));
        } else {
            this.memoizedSerializedSize = (i & Integer.MAX_VALUE) | (this.memoizedSerializedSize & MUTABLE_FLAG_MASK);
        }
    }
}
