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.h;
import kotlin.reflect.w.internal.y0.i.a;
import kotlin.reflect.w.internal.y0.i.c;
import kotlin.reflect.w.internal.y0.i.e;
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 f extends h implements q {

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

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

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

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

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

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

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

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

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

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

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

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

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

        /* JADX INFO: renamed from: n, reason: collision with root package name */
        public c f7786n = c.RETURNS_CONSTANT;

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

        /* JADX INFO: renamed from: p, reason: collision with root package name */
        public h f7788p = h.f7809f;

        /* JADX INFO: renamed from: q, reason: collision with root package name */
        public d f7789q = d.AT_MOST_ONCE;

        @Override // r.i0.w.b.y0.i.p.a
        public p a() {
            f fVarM = m();
            if (fVarM.i()) {
                return fVarM;
            }
            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(kotlin.reflect.w.internal.y0.i.d dVar, kotlin.reflect.w.internal.y0.i.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(kotlin.reflect.w.internal.y0.i.d dVar, kotlin.reflect.w.internal.y0.i.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((f) hVar);
            return this;
        }

        public f m() {
            f fVar = new f(this, null);
            int i2 = this.f7785m;
            int i3 = (i2 & 1) != 1 ? 0 : 1;
            fVar.f7779p = this.f7786n;
            if ((i2 & 2) == 2) {
                this.f7787o = Collections.unmodifiableList(this.f7787o);
                this.f7785m &= -3;
            }
            fVar.f7780q = this.f7787o;
            if ((i2 & 4) == 4) {
                i3 |= 2;
            }
            fVar.f7781r = this.f7788p;
            if ((i2 & 8) == 8) {
                i3 |= 4;
            }
            fVar.f7782s = this.f7789q;
            fVar.f7778o = i3;
            return fVar;
        }

        public b n(f fVar) {
            h hVar;
            if (fVar == f.f7775f) {
                return this;
            }
            if ((fVar.f7778o & 1) == 1) {
                c cVar = fVar.f7779p;
                Objects.requireNonNull(cVar);
                this.f7785m |= 1;
                this.f7786n = cVar;
            }
            if (!fVar.f7780q.isEmpty()) {
                if (this.f7787o.isEmpty()) {
                    this.f7787o = fVar.f7780q;
                    this.f7785m &= -3;
                } else {
                    if ((this.f7785m & 2) != 2) {
                        this.f7787o = new ArrayList(this.f7787o);
                        this.f7785m |= 2;
                    }
                    this.f7787o.addAll(fVar.f7780q);
                }
            }
            if ((fVar.f7778o & 2) == 2) {
                h hVarM = fVar.f7781r;
                if ((this.f7785m & 4) == 4 && (hVar = this.f7788p) != h.f7809f) {
                    h.b bVar = new h.b();
                    bVar.n(hVar);
                    bVar.n(hVarM);
                    hVarM = bVar.m();
                }
                this.f7788p = hVarM;
                this.f7785m |= 4;
            }
            if ((fVar.f7778o & 4) == 4) {
                d dVar = fVar.f7782s;
                Objects.requireNonNull(dVar);
                this.f7785m |= 8;
                this.f7789q = dVar;
            }
            this.f8259f = this.f8259f.b(fVar.f7777n);
            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.f.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.f> r1 = kotlin.reflect.w.internal.y0.g.f.f7776m     // 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.f r3 = (kotlin.reflect.w.internal.y0.g.f) 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.f r4 = (kotlin.reflect.w.internal.y0.g.f) 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.f.b.o(r.i0.w.b.y0.i.d, r.i0.w.b.y0.i.f):r.i0.w.b.y0.g.f$b");
        }
    }

    public enum c implements i.a {
        RETURNS_CONSTANT(0),
        CALLS(1),
        RETURNS_NOT_NULL(2);


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

        c(int i2) {
            this.f7794p = i2;
        }

        public static c b(int i2) {
            if (i2 == 0) {
                return RETURNS_CONSTANT;
            }
            if (i2 == 1) {
                return CALLS;
            }
            if (i2 != 2) {
                return null;
            }
            return RETURNS_NOT_NULL;
        }

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

    public enum d implements i.a {
        AT_MOST_ONCE(0),
        EXACTLY_ONCE(1),
        AT_LEAST_ONCE(2);


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

        d(int i2) {
            this.f7799p = i2;
        }

        public static d b(int i2) {
            if (i2 == 0) {
                return AT_MOST_ONCE;
            }
            if (i2 == 1) {
                return EXACTLY_ONCE;
            }
            if (i2 != 2) {
                return null;
            }
            return AT_LEAST_ONCE;
        }

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

    static {
        f fVar = new f();
        f7775f = fVar;
        fVar.f7779p = c.RETURNS_CONSTANT;
        fVar.f7780q = Collections.emptyList();
        fVar.f7781r = h.f7809f;
        fVar.f7782s = d.AT_MOST_ONCE;
    }

    public f() {
        this.f7783t = (byte) -1;
        this.f7784u = -1;
        this.f7777n = kotlin.reflect.w.internal.y0.i.c.f8234f;
    }

    public f(kotlin.reflect.w.internal.y0.i.d dVar, kotlin.reflect.w.internal.y0.i.f fVar, kotlin.reflect.w.internal.y0.g.a aVar) {
        int iL;
        this.f7783t = (byte) -1;
        this.f7784u = -1;
        this.f7779p = c.RETURNS_CONSTANT;
        this.f7780q = Collections.emptyList();
        this.f7781r = h.f7809f;
        this.f7782s = d.AT_MOST_ONCE;
        c.b bVarN = kotlin.reflect.w.internal.y0.i.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 == 8) {
                                iL = dVar.l();
                                c cVarB = c.b(iL);
                                if (cVarB == null) {
                                    eVarK.y(iO);
                                    eVarK.y(iL);
                                } else {
                                    this.f7778o |= 1;
                                    this.f7779p = cVarB;
                                }
                            } else if (iO == 18) {
                                if ((i2 & 2) != 2) {
                                    this.f7780q = new ArrayList();
                                    i2 |= 2;
                                }
                                this.f7780q.add((h) dVar.h(h.f7810m, fVar));
                            } else if (iO == 26) {
                                h.b bVar = null;
                                if ((this.f7778o & 2) == 2) {
                                    h hVar = this.f7781r;
                                    Objects.requireNonNull(hVar);
                                    h.b bVar2 = new h.b();
                                    bVar2.n(hVar);
                                    bVar = bVar2;
                                }
                                h hVar2 = (h) dVar.h(h.f7810m, fVar);
                                this.f7781r = hVar2;
                                if (bVar != null) {
                                    bVar.n(hVar2);
                                    this.f7781r = bVar.m();
                                }
                                this.f7778o |= 2;
                            } else if (iO == 32) {
                                iL = dVar.l();
                                d dVarB = d.b(iL);
                                if (dVarB == null) {
                                    eVarK.y(iO);
                                    eVarK.y(iL);
                                } else {
                                    this.f7778o |= 4;
                                    this.f7782s = dVarB;
                                }
                            } 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 ((i2 & 2) == 2) {
                    this.f7780q = Collections.unmodifiableList(this.f7780q);
                }
                try {
                    eVarK.j();
                } catch (IOException unused) {
                } catch (Throwable th2) {
                    this.f7777n = bVarN.d();
                    throw th2;
                }
                this.f7777n = bVarN.d();
                throw th;
            }
        }
        if ((i2 & 2) == 2) {
            this.f7780q = Collections.unmodifiableList(this.f7780q);
        }
        try {
            eVarK.j();
        } catch (IOException unused2) {
        } catch (Throwable th3) {
            this.f7777n = bVarN.d();
            throw th3;
        }
        this.f7777n = 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.f7778o & 1) == 1) {
            eVar.n(1, this.f7779p.f7794p);
        }
        for (int i2 = 0; i2 < this.f7780q.size(); i2++) {
            eVar.r(2, this.f7780q.get(i2));
        }
        if ((this.f7778o & 2) == 2) {
            eVar.r(3, this.f7781r);
        }
        if ((this.f7778o & 4) == 4) {
            eVar.n(4, this.f7782s.f7799p);
        }
        eVar.u(this.f7777n);
    }

    @Override // kotlin.reflect.w.internal.y0.i.p
    public int f() {
        int i2 = this.f7784u;
        if (i2 != -1) {
            return i2;
        }
        int iB = (this.f7778o & 1) == 1 ? e.b(1, this.f7779p.f7794p) + 0 : 0;
        for (int i3 = 0; i3 < this.f7780q.size(); i3++) {
            iB += e.e(2, this.f7780q.get(i3));
        }
        if ((this.f7778o & 2) == 2) {
            iB += e.e(3, this.f7781r);
        }
        if ((this.f7778o & 4) == 4) {
            iB += e.b(4, this.f7782s.f7799p);
        }
        int size = this.f7777n.size() + iB;
        this.f7784u = 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.f7783t;
        if (b2 == 1) {
            return true;
        }
        if (b2 == 0) {
            return false;
        }
        for (int i2 = 0; i2 < this.f7780q.size(); i2++) {
            if (!this.f7780q.get(i2).i()) {
                this.f7783t = (byte) 0;
                return false;
            }
        }
        if (!((this.f7778o & 2) == 2) || this.f7781r.i()) {
            this.f7783t = (byte) 1;
            return true;
        }
        this.f7783t = (byte) 0;
        return false;
    }

    public f(h.b bVar, kotlin.reflect.w.internal.y0.g.a aVar) {
        super(bVar);
        this.f7783t = (byte) -1;
        this.f7784u = -1;
        this.f7777n = bVar.f8259f;
    }
}
