package A1;

/* JADX INFO: loaded from: classes.dex */
public final class F implements N {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final E f56a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final x0.o f57b = new x0.o(32);

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

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

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public boolean f60e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public boolean f61f;

    public F(E e8) {
        this.f56a = e8;
    }

    @Override // A1.N
    public final void a() {
        this.f61f = true;
    }

    @Override // A1.N
    public final void b(x0.t tVar, T0.o oVar, M m8) {
        this.f56a.b(tVar, oVar, m8);
        this.f61f = true;
    }

    @Override // A1.N
    public final void c(int i, x0.o oVar) {
        boolean z8 = (i & 1) != 0;
        int iT = z8 ? oVar.f18540b + oVar.t() : -1;
        if (this.f61f) {
            if (!z8) {
                return;
            }
            this.f61f = false;
            oVar.F(iT);
            this.f59d = 0;
        }
        while (oVar.a() > 0) {
            int i5 = this.f59d;
            x0.o oVar2 = this.f57b;
            if (i5 < 3) {
                if (i5 == 0) {
                    int iT2 = oVar.t();
                    oVar.F(oVar.f18540b - 1);
                    if (iT2 == 255) {
                        this.f61f = true;
                        return;
                    }
                }
                int iMin = Math.min(oVar.a(), 3 - this.f59d);
                oVar.e(oVar2.f18539a, this.f59d, iMin);
                int i8 = this.f59d + iMin;
                this.f59d = i8;
                if (i8 == 3) {
                    oVar2.F(0);
                    oVar2.E(3);
                    oVar2.G(1);
                    int iT3 = oVar2.t();
                    int iT4 = oVar2.t();
                    this.f60e = (iT3 & 128) != 0;
                    int i9 = (((iT3 & 15) << 8) | iT4) + 3;
                    this.f58c = i9;
                    byte[] bArr = oVar2.f18539a;
                    if (bArr.length < i9) {
                        oVar2.b(Math.min(4098, Math.max(i9, bArr.length * 2)));
                    }
                }
            } else {
                int iMin2 = Math.min(oVar.a(), this.f58c - this.f59d);
                oVar.e(oVar2.f18539a, this.f59d, iMin2);
                int i10 = this.f59d + iMin2;
                this.f59d = i10;
                int i11 = this.f58c;
                if (i10 != i11) {
                    continue;
                } else {
                    if (!this.f60e) {
                        oVar2.E(i11);
                    } else {
                        if (x0.v.m(0, i11, -1, oVar2.f18539a) != 0) {
                            this.f61f = true;
                            return;
                        }
                        oVar2.E(this.f58c - 4);
                    }
                    oVar2.F(0);
                    this.f56a.e(oVar2);
                    this.f59d = 0;
                }
            }
        }
    }
}
