package g2;

import java.io.IOException;
import java.util.Enumeration;

/* JADX INFO: compiled from: BERTaggedObject.java */
/* JADX INFO: loaded from: classes.dex */
public class i0 extends x {
    public i0(boolean z2, int i3, d dVar) {
        super(z2, i3, dVar);
    }

    @Override // g2.s
    void i(q qVar, boolean z2) throws IOException {
        Enumeration enumerationQ;
        qVar.v(z2, 160, this.f4764e);
        qVar.f(128);
        if (this.f4765f) {
            qVar.u(this.f4766g.c(), true);
        } else {
            d dVar = this.f4766g;
            if (dVar instanceof o) {
                enumerationQ = dVar instanceof c0 ? ((c0) dVar).s() : new c0(((o) dVar).p()).s();
            } else if (dVar instanceof t) {
                enumerationQ = ((t) dVar).r();
            } else {
                if (!(dVar instanceof v)) {
                    throw new g("not implemented: " + this.f4766g.getClass().getName());
                }
                enumerationQ = ((v) dVar).q();
            }
            qVar.h(enumerationQ);
        }
        qVar.f(0);
        qVar.f(0);
    }

    @Override // g2.s
    int j() throws IOException {
        int iB;
        int iJ = this.f4766g.c().j();
        if (this.f4765f) {
            iB = y1.b(this.f4764e) + y1.a(iJ);
        } else {
            iJ--;
            iB = y1.b(this.f4764e);
        }
        return iB + iJ;
    }

    @Override // g2.s
    boolean m() {
        return this.f4765f || this.f4766g.c().m();
    }
}
