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.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.i;
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 o extends h implements q {

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public static final o f7931f;

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

    /* JADX INFO: renamed from: n, reason: collision with root package name */
    public final kotlin.reflect.w.internal.y0.i.c f7933n;

    /* JADX INFO: renamed from: o, reason: collision with root package name */
    public List<c> f7934o;

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

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

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

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

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

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

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

        @Override // r.i0.w.b.y0.i.h.b
        public Object clone() {
            b bVar = new b();
            bVar.n(m());
            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 {
            o(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 {
            o(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.n(m());
            return bVar;
        }

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

        public o m() {
            o oVar = new o(this, null);
            if ((this.f7937m & 1) == 1) {
                this.f7938n = Collections.unmodifiableList(this.f7938n);
                this.f7937m &= -2;
            }
            oVar.f7934o = this.f7938n;
            return oVar;
        }

        public b n(o oVar) {
            if (oVar == o.f7931f) {
                return this;
            }
            if (!oVar.f7934o.isEmpty()) {
                if (this.f7938n.isEmpty()) {
                    this.f7938n = oVar.f7934o;
                    this.f7937m &= -2;
                } else {
                    if ((this.f7937m & 1) != 1) {
                        this.f7938n = new ArrayList(this.f7938n);
                        this.f7937m |= 1;
                    }
                    this.f7938n.addAll(oVar.f7934o);
                }
            }
            this.f8259f = this.f8259f.b(oVar.f7933n);
            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.o.b o(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.o> r1 = kotlin.reflect.w.internal.y0.g.o.f7932m     // 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.o r3 = (kotlin.reflect.w.internal.y0.g.o) r3     // Catch: java.lang.Throwable -> Lf kotlin.reflect.w.internal.y0.i.j -> L11
                if (r3 == 0) goto Le
                r2.n(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.o r4 = (kotlin.reflect.w.internal.y0.g.o) 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.n(r0)
            L1e:
                throw r3
            */
            throw new UnsupportedOperationException("Method not decompiled: r.i0.w.b.y0.g.o.b.o(r.i0.w.b.y0.i.d, r.i0.w.b.y0.i.f):r.i0.w.b.y0.g.o$b");
        }
    }

    static {
        o oVar = new o();
        f7931f = oVar;
        oVar.f7934o = Collections.emptyList();
    }

    public o() {
        this.f7935p = (byte) -1;
        this.f7936q = -1;
        this.f7933n = kotlin.reflect.w.internal.y0.i.c.f8234f;
    }

    public o(d dVar, f fVar, kotlin.reflect.w.internal.y0.g.a aVar) {
        this.f7935p = (byte) -1;
        this.f7936q = -1;
        this.f7934o = Collections.emptyList();
        c.b bVarN = kotlin.reflect.w.internal.y0.i.c.n();
        e eVarK = e.k(bVarN, 1);
        boolean z2 = false;
        boolean z3 = false;
        while (!z2) {
            try {
                try {
                    int iO = dVar.o();
                    if (iO != 0) {
                        if (iO == 10) {
                            if (!(z3 & true)) {
                                this.f7934o = new ArrayList();
                                z3 |= true;
                            }
                            this.f7934o.add((c) dVar.h(c.f7940m, fVar));
                        } else if (!dVar.r(iO, eVarK)) {
                        }
                    }
                    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 (z3 & true) {
                    this.f7934o = Collections.unmodifiableList(this.f7934o);
                }
                try {
                    eVarK.j();
                } catch (IOException unused) {
                } catch (Throwable th2) {
                    this.f7933n = bVarN.d();
                    throw th2;
                }
                this.f7933n = bVarN.d();
                throw th;
            }
        }
        if (z3 & true) {
            this.f7934o = Collections.unmodifiableList(this.f7934o);
        }
        try {
            eVarK.j();
        } catch (IOException unused2) {
        } catch (Throwable th3) {
            this.f7933n = bVarN.d();
            throw th3;
        }
        this.f7933n = bVarN.d();
    }

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

    @Override // kotlin.reflect.w.internal.y0.i.p
    public void d(e eVar) throws IOException {
        f();
        for (int i2 = 0; i2 < this.f7934o.size(); i2++) {
            eVar.r(1, this.f7934o.get(i2));
        }
        eVar.u(this.f7933n);
    }

    @Override // kotlin.reflect.w.internal.y0.i.p
    public int f() {
        int i2 = this.f7936q;
        if (i2 != -1) {
            return i2;
        }
        int iE = 0;
        for (int i3 = 0; i3 < this.f7934o.size(); i3++) {
            iE += e.e(1, this.f7934o.get(i3));
        }
        int size = this.f7933n.size() + iE;
        this.f7936q = 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.f7935p;
        if (b2 == 1) {
            return true;
        }
        if (b2 == 0) {
            return false;
        }
        for (int i2 = 0; i2 < this.f7934o.size(); i2++) {
            if (!this.f7934o.get(i2).i()) {
                this.f7935p = (byte) 0;
                return false;
            }
        }
        this.f7935p = (byte) 1;
        return true;
    }

    public o(h.b bVar, kotlin.reflect.w.internal.y0.g.a aVar) {
        super(bVar);
        this.f7935p = (byte) -1;
        this.f7936q = -1;
        this.f7933n = bVar.f8259f;
    }

    public static final class c extends h implements q {

        /* JADX INFO: renamed from: f, reason: collision with root package name */
        public static final c f7939f;

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

        /* JADX INFO: renamed from: n, reason: collision with root package name */
        public final kotlin.reflect.w.internal.y0.i.c f7941n;

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

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

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

        /* JADX INFO: renamed from: r, reason: collision with root package name */
        public EnumC0151c f7945r;

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

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

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

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

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

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

            /* JADX INFO: renamed from: n, reason: collision with root package name */
            public int f7949n = -1;

            /* JADX INFO: renamed from: p, reason: collision with root package name */
            public EnumC0151c f7951p = EnumC0151c.PACKAGE;

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

            @Override // r.i0.w.b.y0.i.h.b
            public Object clone() {
                b bVar = new b();
                bVar.n(m());
                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 {
                o(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 {
                o(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.n(m());
                return bVar;
            }

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

            public c m() {
                c cVar = new c(this, null);
                int i2 = this.f7948m;
                int i3 = (i2 & 1) != 1 ? 0 : 1;
                cVar.f7943p = this.f7949n;
                if ((i2 & 2) == 2) {
                    i3 |= 2;
                }
                cVar.f7944q = this.f7950o;
                if ((i2 & 4) == 4) {
                    i3 |= 4;
                }
                cVar.f7945r = this.f7951p;
                cVar.f7942o = i3;
                return cVar;
            }

            public b n(c cVar) {
                if (cVar == c.f7939f) {
                    return this;
                }
                int i2 = cVar.f7942o;
                if ((i2 & 1) == 1) {
                    int i3 = cVar.f7943p;
                    this.f7948m |= 1;
                    this.f7949n = i3;
                }
                if ((i2 & 2) == 2) {
                    int i4 = cVar.f7944q;
                    this.f7948m = 2 | this.f7948m;
                    this.f7950o = i4;
                }
                if ((i2 & 4) == 4) {
                    EnumC0151c enumC0151c = cVar.f7945r;
                    Objects.requireNonNull(enumC0151c);
                    this.f7948m = 4 | this.f7948m;
                    this.f7951p = enumC0151c;
                }
                this.f8259f = this.f8259f.b(cVar.f7941n);
                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.o.c.b o(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.o$c> r1 = r.i0.w.b.y0.g.o.c.f7940m     // 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.o$c r3 = (r.i0.w.b.y0.g.o.c) r3     // Catch: java.lang.Throwable -> Lf kotlin.reflect.w.internal.y0.i.j -> L11
                    if (r3 == 0) goto Le
                    r2.n(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.o$c r4 = (r.i0.w.b.y0.g.o.c) 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.n(r0)
                L1e:
                    throw r3
                */
                throw new UnsupportedOperationException("Method not decompiled: r.i0.w.b.y0.g.o.c.b.o(r.i0.w.b.y0.i.d, r.i0.w.b.y0.i.f):r.i0.w.b.y0.g.o$c$b");
            }
        }

        /* JADX INFO: renamed from: r.i0.w.b.y0.g.o$c$c, reason: collision with other inner class name */
        public enum EnumC0151c implements i.a {
            CLASS(0),
            PACKAGE(1),
            LOCAL(2);


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

            EnumC0151c(int i2) {
                this.f7956p = i2;
            }

            public static EnumC0151c b(int i2) {
                if (i2 == 0) {
                    return CLASS;
                }
                if (i2 == 1) {
                    return PACKAGE;
                }
                if (i2 != 2) {
                    return null;
                }
                return LOCAL;
            }

            @Override // r.i0.w.b.y0.i.i.a
            public final int a() {
                return this.f7956p;
            }
        }

        static {
            c cVar = new c();
            f7939f = cVar;
            cVar.f7943p = -1;
            cVar.f7944q = 0;
            cVar.f7945r = EnumC0151c.PACKAGE;
        }

        public c() {
            this.f7946s = (byte) -1;
            this.f7947t = -1;
            this.f7941n = kotlin.reflect.w.internal.y0.i.c.f8234f;
        }

        public c(d dVar, f fVar, kotlin.reflect.w.internal.y0.g.a aVar) {
            this.f7946s = (byte) -1;
            this.f7947t = -1;
            this.f7943p = -1;
            boolean z2 = false;
            this.f7944q = 0;
            this.f7945r = EnumC0151c.PACKAGE;
            c.b bVarN = kotlin.reflect.w.internal.y0.i.c.n();
            e eVarK = e.k(bVarN, 1);
            while (!z2) {
                try {
                    try {
                        try {
                            int iO = dVar.o();
                            if (iO != 0) {
                                if (iO == 8) {
                                    this.f7942o |= 1;
                                    this.f7943p = dVar.l();
                                } else if (iO == 16) {
                                    this.f7942o |= 2;
                                    this.f7944q = dVar.l();
                                } else if (iO == 24) {
                                    int iL = dVar.l();
                                    EnumC0151c enumC0151cB = EnumC0151c.b(iL);
                                    if (enumC0151cB == null) {
                                        eVarK.y(iO);
                                        eVarK.y(iL);
                                    } else {
                                        this.f7942o |= 4;
                                        this.f7945r = enumC0151cB;
                                    }
                                } else if (!dVar.r(iO, eVarK)) {
                                }
                            }
                            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) {
                    try {
                        eVarK.j();
                    } catch (IOException unused) {
                    } catch (Throwable th2) {
                        this.f7941n = bVarN.d();
                        throw th2;
                    }
                    this.f7941n = bVarN.d();
                    throw th;
                }
            }
            try {
                eVarK.j();
            } catch (IOException unused2) {
            } catch (Throwable th3) {
                this.f7941n = bVarN.d();
                throw th3;
            }
            this.f7941n = bVarN.d();
        }

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

        @Override // kotlin.reflect.w.internal.y0.i.p
        public void d(e eVar) throws IOException {
            f();
            if ((this.f7942o & 1) == 1) {
                eVar.p(1, this.f7943p);
            }
            if ((this.f7942o & 2) == 2) {
                eVar.p(2, this.f7944q);
            }
            if ((this.f7942o & 4) == 4) {
                eVar.n(3, this.f7945r.f7956p);
            }
            eVar.u(this.f7941n);
        }

        @Override // kotlin.reflect.w.internal.y0.i.p
        public int f() {
            int i2 = this.f7947t;
            if (i2 != -1) {
                return i2;
            }
            int iC = (this.f7942o & 1) == 1 ? 0 + e.c(1, this.f7943p) : 0;
            if ((this.f7942o & 2) == 2) {
                iC += e.c(2, this.f7944q);
            }
            if ((this.f7942o & 4) == 4) {
                iC += e.b(3, this.f7945r.f7956p);
            }
            int size = this.f7941n.size() + iC;
            this.f7947t = 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.f7946s;
            if (b2 == 1) {
                return true;
            }
            if (b2 == 0) {
                return false;
            }
            if ((this.f7942o & 2) == 2) {
                this.f7946s = (byte) 1;
                return true;
            }
            this.f7946s = (byte) 0;
            return false;
        }

        public c(h.b bVar, kotlin.reflect.w.internal.y0.g.a aVar) {
            super(bVar);
            this.f7946s = (byte) -1;
            this.f7947t = -1;
            this.f7941n = bVar.f8259f;
        }
    }
}
