package kotlin.reflect.w.internal.y0.g;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import kotlin.reflect.w.internal.y0.g.t;
import kotlin.reflect.w.internal.y0.g.w;
import kotlin.reflect.w.internal.y0.i.a;
import kotlin.reflect.w.internal.y0.i.c;
import kotlin.reflect.w.internal.y0.i.d;
import kotlin.reflect.w.internal.y0.i.e;
import kotlin.reflect.w.internal.y0.i.f;
import kotlin.reflect.w.internal.y0.i.h;
import kotlin.reflect.w.internal.y0.i.j;
import kotlin.reflect.w.internal.y0.i.p;
import kotlin.reflect.w.internal.y0.i.q;
import kotlin.reflect.w.internal.y0.i.r;
import kotlin.reflect.w.internal.y0.i.v;

/* JADX INFO: loaded from: classes2.dex */
public final class l extends h.d<l> implements q {

    /* JADX INFO: renamed from: m, reason: collision with root package name */
    public static final l f7873m;

    /* JADX INFO: renamed from: n, reason: collision with root package name */
    public static r<l> f7874n = new a();

    /* JADX INFO: renamed from: o, reason: collision with root package name */
    public final c f7875o;

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

    /* JADX INFO: renamed from: q, reason: collision with root package name */
    public List<i> f7877q;

    /* JADX INFO: renamed from: r, reason: collision with root package name */
    public List<n> f7878r;

    /* JADX INFO: renamed from: s, reason: collision with root package name */
    public List<r> f7879s;

    /* JADX INFO: renamed from: t, reason: collision with root package name */
    public t f7880t;

    /* JADX INFO: renamed from: u, reason: collision with root package name */
    public w f7881u;

    /* JADX INFO: renamed from: v, reason: collision with root package name */
    public byte f7882v;

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

    public static class a extends kotlin.reflect.w.internal.y0.i.b<l> {
        @Override // kotlin.reflect.w.internal.y0.i.r
        public Object a(d dVar, f fVar) {
            return new l(dVar, fVar, null);
        }
    }

    public static final class b extends h.c<l, b> implements q {

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

        /* JADX INFO: renamed from: p, reason: collision with root package name */
        public List<i> f7885p = Collections.emptyList();

        /* JADX INFO: renamed from: q, reason: collision with root package name */
        public List<n> f7886q = Collections.emptyList();

        /* JADX INFO: renamed from: r, reason: collision with root package name */
        public List<r> f7887r = Collections.emptyList();

        /* JADX INFO: renamed from: s, reason: collision with root package name */
        public t f7888s = t.f8059f;

        /* JADX INFO: renamed from: t, reason: collision with root package name */
        public w f7889t = w.f8118f;

        @Override // r.i0.w.b.y0.i.p.a
        public p a() {
            l lVarN = n();
            if (lVarN.i()) {
                return lVarN;
            }
            throw new v();
        }

        @Override // r.i0.w.b.y0.i.h.b
        public Object clone() {
            b bVar = new b();
            bVar.o(n());
            return bVar;
        }

        @Override // kotlin.reflect.w.internal.y0.i.a.AbstractC0155a, r.i0.w.b.y0.i.p.a
        public /* bridge */ /* synthetic */ p.a h(d dVar, f fVar) throws Throwable {
            p(dVar, fVar);
            return this;
        }

        @Override // kotlin.reflect.w.internal.y0.i.a.AbstractC0155a
        /* JADX INFO: renamed from: j */
        public /* bridge */ /* synthetic */ a.AbstractC0155a h(d dVar, f fVar) throws Throwable {
            p(dVar, fVar);
            return this;
        }

        @Override // r.i0.w.b.y0.i.h.b
        /* JADX INFO: renamed from: k */
        public h.b clone() {
            b bVar = new b();
            bVar.o(n());
            return bVar;
        }

        @Override // r.i0.w.b.y0.i.h.b
        public /* bridge */ /* synthetic */ h.b l(h hVar) {
            o((l) hVar);
            return this;
        }

        public l n() {
            l lVar = new l(this, null);
            int i2 = this.f7884o;
            if ((i2 & 1) == 1) {
                this.f7885p = Collections.unmodifiableList(this.f7885p);
                this.f7884o &= -2;
            }
            lVar.f7877q = this.f7885p;
            if ((this.f7884o & 2) == 2) {
                this.f7886q = Collections.unmodifiableList(this.f7886q);
                this.f7884o &= -3;
            }
            lVar.f7878r = this.f7886q;
            if ((this.f7884o & 4) == 4) {
                this.f7887r = Collections.unmodifiableList(this.f7887r);
                this.f7884o &= -5;
            }
            lVar.f7879s = this.f7887r;
            int i3 = (i2 & 8) != 8 ? 0 : 1;
            lVar.f7880t = this.f7888s;
            if ((i2 & 16) == 16) {
                i3 |= 2;
            }
            lVar.f7881u = this.f7889t;
            lVar.f7876p = i3;
            return lVar;
        }

        public b o(l lVar) {
            w wVar;
            t tVar;
            if (lVar == l.f7873m) {
                return this;
            }
            if (!lVar.f7877q.isEmpty()) {
                if (this.f7885p.isEmpty()) {
                    this.f7885p = lVar.f7877q;
                    this.f7884o &= -2;
                } else {
                    if ((this.f7884o & 1) != 1) {
                        this.f7885p = new ArrayList(this.f7885p);
                        this.f7884o |= 1;
                    }
                    this.f7885p.addAll(lVar.f7877q);
                }
            }
            if (!lVar.f7878r.isEmpty()) {
                if (this.f7886q.isEmpty()) {
                    this.f7886q = lVar.f7878r;
                    this.f7884o &= -3;
                } else {
                    if ((this.f7884o & 2) != 2) {
                        this.f7886q = new ArrayList(this.f7886q);
                        this.f7884o |= 2;
                    }
                    this.f7886q.addAll(lVar.f7878r);
                }
            }
            if (!lVar.f7879s.isEmpty()) {
                if (this.f7887r.isEmpty()) {
                    this.f7887r = lVar.f7879s;
                    this.f7884o &= -5;
                } else {
                    if ((this.f7884o & 4) != 4) {
                        this.f7887r = new ArrayList(this.f7887r);
                        this.f7884o |= 4;
                    }
                    this.f7887r.addAll(lVar.f7879s);
                }
            }
            if ((lVar.f7876p & 1) == 1) {
                t tVarM = lVar.f7880t;
                if ((this.f7884o & 8) == 8 && (tVar = this.f7888s) != t.f8059f) {
                    t.b bVarK = t.k(tVar);
                    bVarK.n(tVarM);
                    tVarM = bVarK.m();
                }
                this.f7888s = tVarM;
                this.f7884o |= 8;
            }
            if ((lVar.f7876p & 2) == 2) {
                w wVarM = lVar.f7881u;
                if ((this.f7884o & 16) == 16 && (wVar = this.f7889t) != w.f8118f) {
                    w.b bVarK2 = w.k(wVar);
                    bVarK2.n(wVarM);
                    wVarM = bVarK2.m();
                }
                this.f7889t = wVarM;
                this.f7884o |= 16;
            }
            m(lVar);
            this.f8259f = this.f8259f.b(lVar.f7875o);
            return this;
        }

        /* JADX WARN: Removed duplicated region for block: B:15:0x001b  */
        /*
            Code decompiled incorrectly, please refer to instructions dump.
            To view partially-correct add '--show-bad-code' argument
        */
        public r.i0.w.b.y0.g.l.b p(kotlin.reflect.w.internal.y0.i.d r3, kotlin.reflect.w.internal.y0.i.f r4) throws java.lang.Throwable {
            /*
                r2 = this;
                r0 = 0
                r.i0.w.b.y0.i.r<r.i0.w.b.y0.g.l> r1 = kotlin.reflect.w.internal.y0.g.l.f7874n     // Catch: java.lang.Throwable -> Lf kotlin.reflect.w.internal.y0.i.j -> L11
                java.lang.Object r3 = r1.a(r3, r4)     // Catch: java.lang.Throwable -> Lf kotlin.reflect.w.internal.y0.i.j -> L11
                r.i0.w.b.y0.g.l r3 = (kotlin.reflect.w.internal.y0.g.l) r3     // Catch: java.lang.Throwable -> Lf kotlin.reflect.w.internal.y0.i.j -> L11
                if (r3 == 0) goto Le
                r2.o(r3)
            Le:
                return r2
            Lf:
                r3 = move-exception
                goto L19
            L11:
                r3 = move-exception
                r.i0.w.b.y0.i.p r4 = r3.f8275f     // Catch: java.lang.Throwable -> Lf
                r.i0.w.b.y0.g.l r4 = (kotlin.reflect.w.internal.y0.g.l) r4     // Catch: java.lang.Throwable -> Lf
                throw r3     // Catch: java.lang.Throwable -> L17
            L17:
                r3 = move-exception
                r0 = r4
            L19:
                if (r0 == 0) goto L1e
                r2.o(r0)
            L1e:
                throw r3
            */
            throw new UnsupportedOperationException("Method not decompiled: r.i0.w.b.y0.g.l.b.p(r.i0.w.b.y0.i.d, r.i0.w.b.y0.i.f):r.i0.w.b.y0.g.l$b");
        }
    }

    static {
        l lVar = new l();
        f7873m = lVar;
        lVar.s();
    }

    public l() {
        this.f7882v = (byte) -1;
        this.f7883w = -1;
        this.f7875o = c.f8234f;
    }

    public l(d dVar, f fVar, kotlin.reflect.w.internal.y0.g.a aVar) {
        List list;
        Object obj;
        this.f7882v = (byte) -1;
        this.f7883w = -1;
        s();
        c.b bVarN = c.n();
        e eVarK = e.k(bVarN, 1);
        boolean z2 = false;
        int i2 = 0;
        while (!z2) {
            try {
                try {
                    try {
                        int iO = dVar.o();
                        if (iO != 0) {
                            if (iO == 26) {
                                int i3 = (i2 == true ? 1 : 0) & 1;
                                int i4 = i2;
                                if (i3 != 1) {
                                    this.f7877q = new ArrayList();
                                    i4 = (i2 == true ? 1 : 0) | 1;
                                }
                                list = this.f7877q;
                                i2 = i4;
                                obj = i.f7836n;
                            } else if (iO == 34) {
                                int i5 = (i2 == true ? 1 : 0) & 2;
                                int i6 = i2;
                                if (i5 != 2) {
                                    this.f7878r = new ArrayList();
                                    i6 = (i2 == true ? 1 : 0) | 2;
                                }
                                list = this.f7878r;
                                i2 = i6;
                                obj = n.f7906n;
                            } else if (iO != 42) {
                                w.b bVarK = null;
                                t.b bVarK2 = null;
                                if (iO == 242) {
                                    if ((this.f7876p & 1) == 1) {
                                        t tVar = this.f7880t;
                                        Objects.requireNonNull(tVar);
                                        bVarK2 = t.k(tVar);
                                    }
                                    t tVar2 = (t) dVar.h(t.f8060m, fVar);
                                    this.f7880t = tVar2;
                                    if (bVarK2 != null) {
                                        bVarK2.n(tVar2);
                                        this.f7880t = bVarK2.m();
                                    }
                                    this.f7876p |= 1;
                                } else if (iO == 258) {
                                    if ((this.f7876p & 2) == 2) {
                                        w wVar = this.f7881u;
                                        Objects.requireNonNull(wVar);
                                        bVarK = w.k(wVar);
                                    }
                                    w wVar2 = (w) dVar.h(w.f8119m, fVar);
                                    this.f7881u = wVar2;
                                    if (bVarK != null) {
                                        bVarK.n(wVar2);
                                        this.f7881u = bVarK.m();
                                    }
                                    this.f7876p |= 2;
                                } else if (!q(dVar, eVarK, fVar, iO)) {
                                }
                            } else {
                                int i7 = (i2 == true ? 1 : 0) & 4;
                                int i8 = i2;
                                if (i7 != 4) {
                                    this.f7879s = new ArrayList();
                                    i8 = (i2 == true ? 1 : 0) | 4;
                                }
                                list = this.f7879s;
                                i2 = i8;
                                obj = r.f8011n;
                            }
                            list.add(dVar.h(obj, fVar));
                        }
                        z2 = true;
                    } catch (j e2) {
                        e2.f8275f = this;
                        throw e2;
                    }
                } catch (IOException e3) {
                    j jVar = new j(e3.getMessage());
                    jVar.f8275f = this;
                    throw jVar;
                }
            } catch (Throwable th) {
                if (((i2 == true ? 1 : 0) & 1) == 1) {
                    this.f7877q = Collections.unmodifiableList(this.f7877q);
                }
                if (((i2 == true ? 1 : 0) & 2) == 2) {
                    this.f7878r = Collections.unmodifiableList(this.f7878r);
                }
                if (((i2 == true ? 1 : 0) & 4) == 4) {
                    this.f7879s = Collections.unmodifiableList(this.f7879s);
                }
                try {
                    eVarK.j();
                } catch (IOException unused) {
                } catch (Throwable th2) {
                    this.f7875o = bVarN.d();
                    throw th2;
                }
                this.f7875o = bVarN.d();
                this.f8262f.i();
                throw th;
            }
        }
        if (((i2 == true ? 1 : 0) & 1) == 1) {
            this.f7877q = Collections.unmodifiableList(this.f7877q);
        }
        if (((i2 == true ? 1 : 0) & 2) == 2) {
            this.f7878r = Collections.unmodifiableList(this.f7878r);
        }
        if (((i2 == true ? 1 : 0) & 4) == 4) {
            this.f7879s = Collections.unmodifiableList(this.f7879s);
        }
        try {
            eVarK.j();
        } catch (IOException unused2) {
        } catch (Throwable th3) {
            this.f7875o = bVarN.d();
            throw th3;
        }
        this.f7875o = bVarN.d();
        this.f8262f.i();
    }

    @Override // kotlin.reflect.w.internal.y0.i.q
    public p b() {
        return f7873m;
    }

    @Override // kotlin.reflect.w.internal.y0.i.p
    public p.a c() {
        b bVar = new b();
        bVar.o(this);
        return bVar;
    }

    @Override // kotlin.reflect.w.internal.y0.i.p
    public void d(e eVar) throws IOException {
        f();
        h.d<MessageType>.a aVarP = p();
        for (int i2 = 0; i2 < this.f7877q.size(); i2++) {
            eVar.r(3, this.f7877q.get(i2));
        }
        for (int i3 = 0; i3 < this.f7878r.size(); i3++) {
            eVar.r(4, this.f7878r.get(i3));
        }
        for (int i4 = 0; i4 < this.f7879s.size(); i4++) {
            eVar.r(5, this.f7879s.get(i4));
        }
        if ((this.f7876p & 1) == 1) {
            eVar.r(30, this.f7880t);
        }
        if ((this.f7876p & 2) == 2) {
            eVar.r(32, this.f7881u);
        }
        aVarP.a(200, eVar);
        eVar.u(this.f7875o);
    }

    @Override // kotlin.reflect.w.internal.y0.i.p
    public int f() {
        int i2 = this.f7883w;
        if (i2 != -1) {
            return i2;
        }
        int iE = 0;
        for (int i3 = 0; i3 < this.f7877q.size(); i3++) {
            iE += e.e(3, this.f7877q.get(i3));
        }
        for (int i4 = 0; i4 < this.f7878r.size(); i4++) {
            iE += e.e(4, this.f7878r.get(i4));
        }
        for (int i5 = 0; i5 < this.f7879s.size(); i5++) {
            iE += e.e(5, this.f7879s.get(i5));
        }
        if ((this.f7876p & 1) == 1) {
            iE += e.e(30, this.f7880t);
        }
        if ((this.f7876p & 2) == 2) {
            iE += e.e(32, this.f7881u);
        }
        int size = this.f7875o.size() + l() + iE;
        this.f7883w = size;
        return size;
    }

    @Override // kotlin.reflect.w.internal.y0.i.p
    public p.a g() {
        return new b();
    }

    @Override // kotlin.reflect.w.internal.y0.i.q
    public final boolean i() {
        byte b2 = this.f7882v;
        if (b2 == 1) {
            return true;
        }
        if (b2 == 0) {
            return false;
        }
        for (int i2 = 0; i2 < this.f7877q.size(); i2++) {
            if (!this.f7877q.get(i2).i()) {
                this.f7882v = (byte) 0;
                return false;
            }
        }
        for (int i3 = 0; i3 < this.f7878r.size(); i3++) {
            if (!this.f7878r.get(i3).i()) {
                this.f7882v = (byte) 0;
                return false;
            }
        }
        for (int i4 = 0; i4 < this.f7879s.size(); i4++) {
            if (!this.f7879s.get(i4).i()) {
                this.f7882v = (byte) 0;
                return false;
            }
        }
        if (((this.f7876p & 1) == 1) && !this.f7880t.i()) {
            this.f7882v = (byte) 0;
            return false;
        }
        if (k()) {
            this.f7882v = (byte) 1;
            return true;
        }
        this.f7882v = (byte) 0;
        return false;
    }

    public final void s() {
        this.f7877q = Collections.emptyList();
        this.f7878r = Collections.emptyList();
        this.f7879s = Collections.emptyList();
        this.f7880t = t.f8059f;
        this.f7881u = w.f8118f;
    }

    public l(h.c cVar, kotlin.reflect.w.internal.y0.g.a aVar) {
        super(cVar);
        this.f7882v = (byte) -1;
        this.f7883w = -1;
        this.f7875o = cVar.f8259f;
    }
}
