package o;

import java.io.IOException;
import java.util.List;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* renamed from: o.qt0, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public abstract class AbstractC2286qt0 implements Cloneable {
    public final AbstractC2665ut0 l;
    public AbstractC2665ut0 m;

    public AbstractC2286qt0(AbstractC2665ut0 abstractC2665ut0) {
        this.l = abstractC2665ut0;
        if (abstractC2665ut0.e()) {
            throw new IllegalArgumentException("Default instance must be immutable.");
        }
        this.m = (AbstractC2665ut0) abstractC2665ut0.o(4);
    }

    public static void a(int i, List list) {
        int size = list.size() - i;
        StringBuilder sb = new StringBuilder(String.valueOf(size).length() + 26);
        sb.append("Element at index ");
        sb.append(size);
        sb.append(" is null.");
        String string = sb.toString();
        int size2 = list.size();
        while (true) {
            size2--;
            if (size2 < i) {
                throw new NullPointerException(string);
            }
            list.remove(size2);
        }
    }

    public final void b() {
        if (this.m.e()) {
            return;
        }
        AbstractC2665ut0 abstractC2665ut0 = (AbstractC2665ut0) this.l.o(4);
        C1241fu0.c.a(abstractC2665ut0.getClass()).d(abstractC2665ut0, this.m);
        this.m = abstractC2665ut0;
    }

    /* renamed from: c, reason: merged with bridge method [inline-methods] */
    public final AbstractC2286qt0 clone() {
        AbstractC2286qt0 abstractC2286qt0 = (AbstractC2286qt0) this.l.o(5);
        abstractC2286qt0.m = d();
        return abstractC2286qt0;
    }

    public final AbstractC2665ut0 d() {
        if (!this.m.e()) {
            return this.m;
        }
        this.m.g();
        return this.m;
    }

    public final AbstractC2665ut0 e() {
        AbstractC2665ut0 abstractC2665ut0D = d();
        abstractC2665ut0D.getClass();
        boolean zG = true;
        byte bByteValue = ((Byte) abstractC2665ut0D.o(1)).byteValue();
        if (bByteValue != 1) {
            if (bByteValue == 0) {
                zG = false;
            } else {
                zG = C1241fu0.c.a(abstractC2665ut0D.getClass()).g(abstractC2665ut0D);
                abstractC2665ut0D.o(2);
            }
        }
        if (zG) {
            return abstractC2665ut0D;
        }
        throw new C2170pj("Message was missing required fields.  (Lite runtime could not determine which fields were missing).");
    }

    public final void f(AbstractC2665ut0 abstractC2665ut0) {
        AbstractC2665ut0 abstractC2665ut02 = this.l;
        if (abstractC2665ut02.equals(abstractC2665ut0)) {
            return;
        }
        if (!this.m.e()) {
            AbstractC2665ut0 abstractC2665ut03 = (AbstractC2665ut0) abstractC2665ut02.o(4);
            C1241fu0.c.a(abstractC2665ut03.getClass()).d(abstractC2665ut03, this.m);
            this.m = abstractC2665ut03;
        }
        AbstractC2665ut0 abstractC2665ut04 = this.m;
        C1241fu0.c.a(abstractC2665ut04.getClass()).d(abstractC2665ut04, abstractC2665ut0);
    }

    public final void g(byte[] bArr, int i, C1239ft0 c1239ft0) throws Gt0 {
        if (!this.m.e()) {
            AbstractC2665ut0 abstractC2665ut0 = (AbstractC2665ut0) this.l.o(4);
            C1241fu0.c.a(abstractC2665ut0.getClass()).d(abstractC2665ut0, this.m);
            this.m = abstractC2665ut0;
        }
        try {
            InterfaceC1718ku0 interfaceC1718ku0A = C1241fu0.c.a(this.m.getClass());
            AbstractC2665ut0 abstractC2665ut02 = this.m;
            Rs0 rs0 = new Rs0();
            c1239ft0.getClass();
            interfaceC1718ku0A.a(abstractC2665ut02, bArr, 0, i, rs0);
        } catch (IndexOutOfBoundsException unused) {
            throw new Gt0("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.");
        } catch (Gt0 e) {
            throw e;
        } catch (IOException e2) {
            throw new RuntimeException("Reading from byte array should not throw IOException.", e2);
        }
    }
}
