package g2;

import java.io.IOException;

/* JADX INFO: compiled from: DERSequence.java */
/* JADX INFO: loaded from: classes.dex */
public class z0 extends t {

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    private int f4771f;

    public z0(e eVar) {
        super(eVar);
        this.f4771f = -1;
    }

    private int s() throws IOException {
        if (this.f4771f < 0) {
            int length = this.f4741e.length;
            int iJ = 0;
            for (int i3 = 0; i3 < length; i3++) {
                iJ += this.f4741e[i3].c().n().j();
            }
            this.f4771f = iJ;
        }
        return this.f4771f;
    }

    @Override // g2.s
    void i(q qVar, boolean z2) throws IOException {
        if (z2) {
            qVar.f(48);
        }
        x0 x0VarD = qVar.d();
        int length = this.f4741e.length;
        int i3 = 0;
        if (this.f4771f >= 0 || length > 16) {
            qVar.r(s());
            while (i3 < length) {
                this.f4741e[i3].c().n().i(x0VarD, true);
                i3++;
            }
            return;
        }
        s[] sVarArr = new s[length];
        int iJ = 0;
        for (int i4 = 0; i4 < length; i4++) {
            s sVarN = this.f4741e[i4].c().n();
            sVarArr[i4] = sVarN;
            iJ += sVarN.j();
        }
        this.f4771f = iJ;
        qVar.r(iJ);
        while (i3 < length) {
            sVarArr[i3].i(x0VarD, true);
            i3++;
        }
    }

    @Override // g2.s
    int j() throws IOException {
        int iS = s();
        return y1.a(iS) + 1 + iS;
    }

    @Override // g2.t, g2.s
    s n() {
        return this;
    }

    @Override // g2.t, g2.s
    s o() {
        return this;
    }

    z0(d[] dVarArr, boolean z2) {
        super(dVarArr, z2);
        this.f4771f = -1;
    }
}
