package o1;

import java.io.EOFException;
import java.io.InterruptedIOException;
import x0.AbstractC1709a;
import x0.o;

/* JADX INFO: renamed from: o1.e, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public final class C1329e {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final C1330f f15598a = new C1330f();

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final o f15599b = new o(0, new byte[65025]);

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public int f15600c = -1;

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

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

    public final int a(int i) {
        int i5;
        int i8 = 0;
        this.f15601d = 0;
        do {
            int i9 = this.f15601d;
            int i10 = i + i9;
            C1330f c1330f = this.f15598a;
            if (i10 >= c1330f.f15605c) {
                break;
            }
            int[] iArr = c1330f.f15608f;
            this.f15601d = i9 + 1;
            i5 = iArr[i9 + i];
            i8 += i5;
        } while (i5 == 255);
        return i8;
    }

    public final boolean b(T0.j jVar) throws InterruptedIOException {
        int i;
        AbstractC1709a.j(jVar != null);
        boolean z8 = this.f15602e;
        o oVar = this.f15599b;
        if (z8) {
            this.f15602e = false;
            oVar.C(0);
        }
        while (!this.f15602e) {
            int i5 = this.f15600c;
            C1330f c1330f = this.f15598a;
            if (i5 < 0) {
                if (c1330f.b(jVar, -1L) && c1330f.a(jVar, true)) {
                    int iA = c1330f.f15606d;
                    if ((c1330f.f15603a & 1) == 1 && oVar.f18541c == 0) {
                        iA += a(0);
                        i = this.f15601d;
                    } else {
                        i = 0;
                    }
                    try {
                        jVar.b(iA);
                        this.f15600c = i;
                    } catch (EOFException unused) {
                    }
                }
                return false;
            }
            int iA2 = a(this.f15600c);
            int i8 = this.f15600c + this.f15601d;
            if (iA2 > 0) {
                oVar.b(oVar.f18541c + iA2);
                jVar.c(oVar.f18539a, oVar.f18541c, iA2, false);
                oVar.E(oVar.f18541c + iA2);
                this.f15602e = c1330f.f15608f[i8 + (-1)] != 255;
            }
            if (i8 == c1330f.f15605c) {
                i8 = -1;
            }
            this.f15600c = i8;
        }
        return true;
    }
}
