package z0;

import y0.d3;
import y0.p;

/* loaded from: classes.dex */
public abstract class f {
    private static final int c(d3 d3Var) {
        int a02 = d3Var.a0();
        int c02 = d3Var.c0();
        while (c02 >= 0 && !d3Var.r0(c02)) {
            c02 = d3Var.E0(c02);
        }
        int i10 = c02 + 1;
        int i11 = 0;
        while (i10 < a02) {
            if (d3Var.m0(a02, i10)) {
                if (d3Var.r0(i10)) {
                    i11 = 0;
                }
                i10++;
            } else {
                i11 += d3Var.r0(i10) ? 1 : d3Var.C0(i10);
                i10 += d3Var.k0(i10);
            }
        }
        return i11;
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final int d(d3 d3Var, y0.d dVar, y0.f fVar) {
        int F = d3Var.F(dVar);
        p.O(d3Var.a0() < F);
        e(d3Var, fVar, F);
        int c10 = c(d3Var);
        while (d3Var.a0() < F) {
            if (d3Var.l0(F)) {
                if (d3Var.q0()) {
                    fVar.d(d3Var.A0(d3Var.a0()));
                    c10 = 0;
                }
                d3Var.g1();
            } else {
                c10 += d3Var.V0();
            }
        }
        p.O(d3Var.a0() == F);
        return c10;
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final void e(d3 d3Var, y0.f fVar, int i10) {
        while (!d3Var.n0(i10)) {
            d3Var.W0();
            if (d3Var.r0(d3Var.c0())) {
                fVar.g();
            }
            d3Var.T();
        }
    }
}
