package o;

import com.google.android.gms.common.api.Api;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* renamed from: o.ut0, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public abstract class AbstractC2665ut0 extends Ns0 {
    private static final Map zzd = new ConcurrentHashMap();
    private int zzb;
    protected C2857wu0 zzc;

    public AbstractC2665ut0() {
        this.zza = 0;
        this.zzb = -1;
        this.zzc = C2857wu0.f;
    }

    public static AbstractC2665ut0 l(Class cls) throws ClassNotFoundException {
        Map map = zzd;
        AbstractC2665ut0 abstractC2665ut0 = (AbstractC2665ut0) map.get(cls);
        if (abstractC2665ut0 == null) {
            try {
                Class.forName(cls.getName(), true, cls.getClassLoader());
                abstractC2665ut0 = (AbstractC2665ut0) map.get(cls);
            } catch (ClassNotFoundException e) {
                throw new IllegalStateException("Class initialization cannot fail.", e);
            }
        }
        if (abstractC2665ut0 != null) {
            return abstractC2665ut0;
        }
        AbstractC2665ut0 abstractC2665ut02 = (AbstractC2665ut0) ((AbstractC2665ut0) Fu0.e(cls)).o(6);
        if (abstractC2665ut02 == null) {
            throw new IllegalStateException();
        }
        map.put(cls, abstractC2665ut02);
        return abstractC2665ut02;
    }

    public static void m(Class cls, AbstractC2665ut0 abstractC2665ut0) {
        abstractC2665ut0.f();
        zzd.put(cls, abstractC2665ut0);
    }

    public static Object n(Method method, AbstractC2665ut0 abstractC2665ut0, Object... objArr) {
        try {
            return method.invoke(abstractC2665ut0, objArr);
        } catch (IllegalAccessException e) {
            throw new RuntimeException("Couldn't use Java reflection to implement protocol message reflection.", e);
        } catch (InvocationTargetException e2) {
            Throwable cause = e2.getCause();
            if (cause instanceof RuntimeException) {
                throw ((RuntimeException) cause);
            }
            if (cause instanceof Error) {
                throw ((Error) cause);
            }
            throw new RuntimeException("Unexpected exception thrown by generated accessor method.", cause);
        }
    }

    @Override // o.Ns0
    public final int b(InterfaceC1718ku0 interfaceC1718ku0) {
        if (e()) {
            int iF = interfaceC1718ku0.f(this);
            if (iF >= 0) {
                return iF;
            }
            StringBuilder sb = new StringBuilder(String.valueOf(iF).length() + 42);
            sb.append("serialized size must be non-negative, was ");
            sb.append(iF);
            throw new IllegalStateException(sb.toString());
        }
        int i = this.zzb & Api.BaseClientBuilder.API_PRIORITY_OTHER;
        if (i != Integer.MAX_VALUE) {
            return i;
        }
        int iF2 = interfaceC1718ku0.f(this);
        if (iF2 >= 0) {
            this.zzb = (this.zzb & Integer.MIN_VALUE) | iF2;
            return iF2;
        }
        StringBuilder sb2 = new StringBuilder(String.valueOf(iF2).length() + 42);
        sb2.append("serialized size must be non-negative, was ");
        sb2.append(iF2);
        throw new IllegalStateException(sb2.toString());
    }

    public final void d(Zs0 zs0) {
        InterfaceC1718ku0 interfaceC1718ku0A = C1241fu0.c.a(getClass());
        C1696kj0 c1696kj0 = zs0.l;
        if (c1696kj0 == null) {
            c1696kj0 = new C1696kj0(zs0);
        }
        interfaceC1718ku0A.c(this, c1696kj0);
    }

    public final boolean e() {
        return (this.zzb & Integer.MIN_VALUE) != 0;
    }

    public final boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null || getClass() != obj.getClass()) {
            return false;
        }
        return C1241fu0.c.a(getClass()).e(this, (AbstractC2665ut0) obj);
    }

    public final void f() {
        this.zzb &= Api.BaseClientBuilder.API_PRIORITY_OTHER;
    }

    public final void g() {
        C1241fu0.c.a(getClass()).b(this);
        f();
    }

    public final AbstractC2286qt0 h() {
        return (AbstractC2286qt0) o(5);
    }

    public final int hashCode() {
        if (e()) {
            return C1241fu0.c.a(getClass()).h(this);
        }
        int i = this.zza;
        if (i != 0) {
            return i;
        }
        int iH = C1241fu0.c.a(getClass()).h(this);
        this.zza = iH;
        return iH;
    }

    public final AbstractC2286qt0 i() {
        AbstractC2286qt0 abstractC2286qt0 = (AbstractC2286qt0) o(5);
        abstractC2286qt0.f(this);
        return abstractC2286qt0;
    }

    public final void j() {
        this.zzb = (this.zzb & Integer.MIN_VALUE) | Api.BaseClientBuilder.API_PRIORITY_OTHER;
    }

    public final int k() {
        if (e()) {
            int iF = C1241fu0.c.a(getClass()).f(this);
            if (iF >= 0) {
                return iF;
            }
            StringBuilder sb = new StringBuilder(String.valueOf(iF).length() + 42);
            sb.append("serialized size must be non-negative, was ");
            sb.append(iF);
            throw new IllegalStateException(sb.toString());
        }
        int i = this.zzb & Api.BaseClientBuilder.API_PRIORITY_OTHER;
        if (i != Integer.MAX_VALUE) {
            return i;
        }
        int iF2 = C1241fu0.c.a(getClass()).f(this);
        if (iF2 >= 0) {
            this.zzb = (this.zzb & Integer.MIN_VALUE) | iF2;
            return iF2;
        }
        StringBuilder sb2 = new StringBuilder(String.valueOf(iF2).length() + 42);
        sb2.append("serialized size must be non-negative, was ");
        sb2.append(iF2);
        throw new IllegalStateException(sb2.toString());
    }

    public abstract Object o(int i);

    public final String toString() {
        String string = super.toString();
        char[] cArr = Yt0.a;
        StringBuilder sb = new StringBuilder();
        sb.append("# ");
        sb.append(string);
        Yt0.b(this, sb, 0);
        return sb.toString();
    }
}
