package androidx.leanback.widget;

import N1.C0224z;
import androidx.datastore.preferences.protobuf.C0432j;

/* JADX INFO: loaded from: classes.dex */
public final class G0 extends r {

    /* JADX INFO: renamed from: j, reason: collision with root package name */
    public C0432j f8379j;

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

    /* JADX INFO: renamed from: l, reason: collision with root package name */
    public Object f8381l;

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

    @Override // androidx.leanback.widget.r
    public final boolean b(int i, boolean z8) {
        Object[] objArr = this.f8701a;
        if (this.f8702b.r() == 0 || (!z8 && c(i))) {
            return false;
        }
        try {
            if (!o(i, z8)) {
                return q(i, z8);
            }
            objArr[0] = null;
            this.f8381l = null;
            return true;
        } finally {
            objArr[0] = null;
            this.f8381l = null;
        }
    }

    @Override // androidx.leanback.widget.r
    public final int f(int i, boolean z8, int[] iArr) {
        int i5;
        int iS = this.f8702b.s(i);
        F0 f0K = k(i);
        int i8 = f0K.f7097q;
        if (this.f8703c) {
            i5 = i8;
            int i9 = i5;
            int i10 = 1;
            int i11 = iS;
            for (int i12 = i + 1; i10 < this.f8705e && i12 <= this.f8707g; i12++) {
                F0 f0K2 = k(i12);
                i11 += f0K2.f8371r;
                int i13 = f0K2.f7097q;
                if (i13 != i9) {
                    i10++;
                    if (!z8 ? i11 >= iS : i11 <= iS) {
                        i9 = i13;
                    } else {
                        iS = i11;
                        i = i12;
                        i5 = i13;
                        i9 = i5;
                    }
                }
            }
        } else {
            int i14 = 1;
            int i15 = i8;
            F0 f0K3 = f0K;
            int i16 = iS;
            iS = this.f8702b.t(i) + iS;
            i5 = i15;
            for (int i17 = i - 1; i14 < this.f8705e && i17 >= this.f8706f; i17--) {
                i16 -= f0K3.f8371r;
                f0K3 = k(i17);
                int i18 = f0K3.f7097q;
                if (i18 != i15) {
                    i14++;
                    int iT = this.f8702b.t(i17) + i16;
                    if (!z8 ? iT >= iS : iT <= iS) {
                        i15 = i18;
                    } else {
                        iS = iT;
                        i = i17;
                        i5 = i18;
                        i15 = i5;
                    }
                }
            }
        }
        if (iArr != null) {
            iArr[0] = i5;
            iArr[1] = i;
        }
        return iS;
    }

    @Override // androidx.leanback.widget.r
    public final int h(int i, boolean z8, int[] iArr) {
        int iT;
        int iS = this.f8702b.s(i);
        F0 f0K = k(i);
        int i5 = f0K.f7097q;
        if (this.f8703c) {
            int i8 = 1;
            iT = iS - this.f8702b.t(i);
            int i9 = i5;
            for (int i10 = i - 1; i8 < this.f8705e && i10 >= this.f8706f; i10--) {
                iS -= f0K.f8371r;
                f0K = k(i10);
                int i11 = f0K.f7097q;
                if (i11 != i9) {
                    i8++;
                    int iT2 = iS - this.f8702b.t(i10);
                    if (!z8 ? iT2 >= iT : iT2 <= iT) {
                        i9 = i11;
                    } else {
                        iT = iT2;
                        i = i10;
                        i5 = i11;
                        i9 = i5;
                    }
                }
            }
        } else {
            int i12 = i5;
            int i13 = i12;
            int i14 = 1;
            int i15 = iS;
            for (int i16 = i + 1; i14 < this.f8705e && i16 <= this.f8707g; i16++) {
                F0 f0K2 = k(i16);
                i15 += f0K2.f8371r;
                int i17 = f0K2.f7097q;
                if (i17 != i13) {
                    i14++;
                    if (!z8 ? i15 >= iS : i15 <= iS) {
                        i13 = i17;
                    } else {
                        iS = i15;
                        i = i16;
                        i12 = i17;
                        i13 = i12;
                    }
                }
            }
            iT = iS;
            i5 = i12;
        }
        if (iArr != null) {
            iArr[0] = i5;
            iArr[1] = i;
        }
        return iT;
    }

    /* JADX WARN: Removed duplicated region for block: B:20:0x0051  */
    @Override // androidx.leanback.widget.r
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final C0224z[] j(int i, int i5) {
        for (int i8 = 0; i8 < this.f8705e; i8++) {
            C0224z c0224z = this.f8708h[i8];
            c0224z.f4727c = c0224z.f4726b;
        }
        if (i >= 0) {
            while (i <= i5) {
                C0224z c0224z2 = this.f8708h[k(i).f7097q];
                if (c0224z2.e() <= 0) {
                    c0224z2.a(i);
                    c0224z2.a(i);
                } else {
                    int i9 = c0224z2.f4726b;
                    int i10 = c0224z2.f4727c;
                    if (i9 == i10) {
                        throw new ArrayIndexOutOfBoundsException();
                    }
                    int[] iArr = c0224z2.f4725a;
                    int i11 = c0224z2.f4728d;
                    if (iArr[(i10 - 1) & i11] == i - 1) {
                        if (i9 == i10) {
                            throw new ArrayIndexOutOfBoundsException();
                        }
                        int i12 = (i10 - 1) & i11;
                        int i13 = iArr[i12];
                        c0224z2.f4727c = i12;
                        c0224z2.a(i);
                    }
                }
                i++;
            }
        }
        return this.f8708h;
    }

    @Override // androidx.leanback.widget.r
    public final void l(int i) {
        super.l(i);
        int iS = (s() - i) + 1;
        C0432j c0432j = this.f8379j;
        c0432j.T(iS);
        if (c0432j.X() == 0) {
            this.f8380k = -1;
        }
    }

    @Override // androidx.leanback.widget.r
    public final boolean m(int i, boolean z8) {
        Object[] objArr = this.f8701a;
        if (this.f8702b.r() == 0 || (!z8 && d(i))) {
            return false;
        }
        try {
            if (!w(i, z8)) {
                return y(i, z8);
            }
            objArr[0] = null;
            this.f8381l = null;
            return true;
        } finally {
            objArr[0] = null;
            this.f8381l = null;
        }
    }

    public final boolean o(int i, boolean z8) {
        int i5;
        int iS;
        int i8;
        C0432j c0432j = this.f8379j;
        if (c0432j.X() != 0) {
            int iR = this.f8702b.r();
            int i9 = this.f8707g;
            if (i9 >= 0) {
                i5 = i9 + 1;
                iS = this.f8702b.s(i9);
            } else {
                int i10 = this.i;
                i5 = i10 != -1 ? i10 : 0;
                if (i5 > s() + 1 || i5 < this.f8380k) {
                    c0432j.U(c0432j.X());
                    return false;
                }
                if (i5 <= s()) {
                    iS = Integer.MAX_VALUE;
                }
            }
            int iS2 = s();
            int i11 = i5;
            while (i11 < iR && i11 <= iS2) {
                F0 f0K = k(i11);
                if (iS != Integer.MAX_VALUE) {
                    iS += f0K.f8371r;
                }
                int i12 = iS;
                int i13 = f0K.f7097q;
                P.g gVar = this.f8702b;
                Object[] objArr = this.f8701a;
                int iQ = gVar.q(i11, true, objArr, false);
                if (iQ != f0K.f8372s) {
                    f0K.f8372s = iQ;
                    c0432j.T(iS2 - i11);
                    i8 = i11;
                } else {
                    i8 = iS2;
                }
                this.f8707g = i11;
                if (this.f8706f < 0) {
                    this.f8706f = i11;
                }
                this.f8702b.p(objArr[0], i11, iQ, i13, i12);
                if (z8 || !c(i)) {
                    iS = i12 == Integer.MAX_VALUE ? this.f8702b.s(i11) : i12;
                    if (i13 != this.f8705e - 1 || !z8) {
                        i11++;
                        iS2 = i8;
                    }
                }
                return true;
            }
        }
        return false;
    }

    public final int p(int i, int i5, int i8) {
        int iS;
        int i9 = this.f8707g;
        if (i9 >= 0 && (i9 != s() || this.f8707g != i - 1)) {
            throw new IllegalStateException();
        }
        int i10 = this.f8707g;
        C0432j c0432j = this.f8379j;
        if (i10 >= 0) {
            iS = i8 - this.f8702b.s(i10);
        } else if (c0432j.X() <= 0 || i != s() + 1) {
            iS = 0;
        } else {
            int iS2 = s();
            while (true) {
                if (iS2 < this.f8380k) {
                    iS2 = s();
                    break;
                }
                if (k(iS2).f7097q == i5) {
                    break;
                }
                iS2--;
            }
            iS = this.f8703c ? (-k(iS2).f8372s) - this.f8704d : k(iS2).f8372s + this.f8704d;
            for (int i11 = iS2 + 1; i11 <= s(); i11++) {
                iS -= k(i11).f8371r;
            }
        }
        F0 f02 = new F0(i5, iS);
        c0432j.b(f02);
        Object obj = this.f8381l;
        if (obj != null) {
            f02.f8372s = this.f8382m;
            this.f8381l = null;
        } else {
            P.g gVar = this.f8702b;
            Object[] objArr = this.f8701a;
            f02.f8372s = gVar.q(i, true, objArr, false);
            obj = objArr[0];
        }
        Object obj2 = obj;
        if (c0432j.X() == 1) {
            this.f8707g = i;
            this.f8706f = i;
            this.f8380k = i;
        } else {
            int i12 = this.f8707g;
            if (i12 < 0) {
                this.f8707g = i;
                this.f8706f = i;
            } else {
                this.f8707g = i12 + 1;
            }
        }
        this.f8702b.p(obj2, i, f02.f8372s, i5, i8);
        return f02.f8372s;
    }

    /* JADX WARN: Code restructure failed: missing block: B:105:0x0136, code lost:
    
        return true;
     */
    /* JADX WARN: Removed duplicated region for block: B:107:0x0139  */
    /* JADX WARN: Removed duplicated region for block: B:88:0x0107 A[LOOP:2: B:88:0x0107->B:104:0x012b, LOOP_START, PHI: r6 r9 r10
      0x0107: PHI (r6v12 int) = (r6v6 int), (r6v16 int) binds: [B:87:0x0105, B:104:0x012b] A[DONT_GENERATE, DONT_INLINE]
      0x0107: PHI (r9v20 int) = (r9v18 int), (r9v21 int) binds: [B:87:0x0105, B:104:0x012b] A[DONT_GENERATE, DONT_INLINE]
      0x0107: PHI (r10v7 int) = (r10v5 int), (r10v9 int) binds: [B:87:0x0105, B:104:0x012b] A[DONT_GENERATE, DONT_INLINE]] */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final boolean q(int i, boolean z8) {
        int i5;
        int i8;
        boolean z9;
        int iV;
        int i9;
        int i10;
        int iR = this.f8702b.r();
        int i11 = this.f8707g;
        if (i11 < 0) {
            int i12 = this.i;
            i5 = i12 != -1 ? i12 : 0;
            i8 = (this.f8379j.X() > 0 ? k(s()).f7097q + 1 : i5) % this.f8705e;
            z9 = false;
            iV = 0;
        } else {
            if (i11 < s()) {
                return false;
            }
            int i13 = this.f8707g;
            i5 = i13 + 1;
            i8 = k(i13).f7097q;
            int iR2 = r(true);
            if (iR2 < 0) {
                iV = Integer.MIN_VALUE;
                for (int i14 = 0; i14 < this.f8705e; i14++) {
                    iV = this.f8703c ? v(i14) : u(i14);
                    if (iV != Integer.MIN_VALUE) {
                        break;
                    }
                }
            } else {
                iV = this.f8703c ? h(iR2, false, null) : f(iR2, true, null);
            }
            if (!this.f8703c ? u(i8) >= iV : v(i8) <= iV) {
                i8++;
                if (i8 == this.f8705e) {
                    iV = this.f8703c ? i(false, null) : g(true, null);
                    i8 = 0;
                }
            }
            z9 = true;
        }
        boolean z10 = false;
        loop1: while (true) {
            if (i8 < this.f8705e) {
                if (i5 == iR || (!z8 && c(i))) {
                    break;
                }
                int iV2 = this.f8703c ? v(i8) : u(i8);
                if (iV2 == Integer.MAX_VALUE || iV2 == Integer.MIN_VALUE) {
                    if (i8 == 0) {
                        iV2 = this.f8703c ? v(this.f8705e - 1) : u(this.f8705e - 1);
                        if (iV2 != Integer.MAX_VALUE && iV2 != Integer.MIN_VALUE) {
                            if (this.f8703c) {
                                i10 = this.f8704d;
                                i9 = -i10;
                                iV2 += i9;
                            } else {
                                i9 = this.f8704d;
                                iV2 += i9;
                            }
                        }
                    } else {
                        iV2 = this.f8703c ? u(i8 - 1) : v(i8 - 1);
                    }
                    int i15 = i5 + 1;
                    int iP = p(i5, i8, iV2);
                    if (z9) {
                        while (true) {
                            if (!this.f8703c) {
                                if (iV2 + iP >= iV) {
                                    break;
                                }
                                if (i15 == iR) {
                                    break loop1;
                                }
                                break loop1;
                                break loop1;
                            }
                            if (iV2 - iP <= iV) {
                                break;
                            }
                            if (i15 == iR || (!z8 && c(i))) {
                                break loop1;
                            }
                            iV2 += this.f8703c ? (-iP) - this.f8704d : iP + this.f8704d;
                            int i16 = i15 + 1;
                            int iP2 = p(i15, i8, iV2);
                            i15 = i16;
                            iP = iP2;
                        }
                    } else {
                        z9 = true;
                        iV = this.f8703c ? v(i8) : u(i8);
                    }
                    i5 = i15;
                    i8++;
                    z10 = true;
                } else if (this.f8703c) {
                    i10 = this.f8704d;
                    i9 = -i10;
                    iV2 += i9;
                    int i152 = i5 + 1;
                    int iP3 = p(i5, i8, iV2);
                    if (z9) {
                    }
                    i5 = i152;
                    i8++;
                    z10 = true;
                } else {
                    i9 = this.f8704d;
                    iV2 += i9;
                    int i1522 = i5 + 1;
                    int iP32 = p(i5, i8, iV2);
                    if (z9) {
                    }
                    i5 = i1522;
                    i8++;
                    z10 = true;
                }
            } else {
                if (z8) {
                    break;
                }
                iV = this.f8703c ? i(false, null) : g(true, null);
                i8 = 0;
            }
        }
        return z10;
    }

    public final int r(boolean z8) {
        boolean z9 = false;
        if (z8) {
            for (int i = this.f8707g; i >= this.f8706f; i--) {
                int i5 = k(i).f7097q;
                if (i5 == 0) {
                    z9 = true;
                } else if (z9 && i5 == this.f8705e - 1) {
                    return i;
                }
            }
            return -1;
        }
        for (int i8 = this.f8706f; i8 <= this.f8707g; i8++) {
            int i9 = k(i8).f7097q;
            if (i9 == this.f8705e - 1) {
                z9 = true;
            } else if (z9 && i9 == 0) {
                return i8;
            }
        }
        return -1;
    }

    public final int s() {
        return (this.f8379j.X() + this.f8380k) - 1;
    }

    @Override // androidx.leanback.widget.r
    /* JADX INFO: renamed from: t, reason: merged with bridge method [inline-methods] */
    public final F0 k(int i) {
        int i5 = i - this.f8380k;
        if (i5 < 0) {
            return null;
        }
        C0432j c0432j = this.f8379j;
        if (i5 >= c0432j.X()) {
            return null;
        }
        return (F0) c0432j.d(i5);
    }

    public final int u(int i) {
        int i5;
        F0 f0K;
        int i8 = this.f8706f;
        if (i8 < 0) {
            return Integer.MIN_VALUE;
        }
        if (this.f8703c) {
            int iS = this.f8702b.s(i8);
            if (k(this.f8706f).f7097q == i) {
                return iS;
            }
            int i9 = this.f8706f;
            do {
                i9++;
                if (i9 <= s()) {
                    f0K = k(i9);
                    iS += f0K.f8371r;
                }
            } while (f0K.f7097q != i);
            return iS;
        }
        int iS2 = this.f8702b.s(this.f8707g);
        F0 f0K2 = k(this.f8707g);
        if (f0K2.f7097q == i) {
            i5 = f0K2.f8372s;
        } else {
            int i10 = this.f8707g;
            do {
                i10--;
                if (i10 >= this.f8380k) {
                    iS2 -= f0K2.f8371r;
                    f0K2 = k(i10);
                }
            } while (f0K2.f7097q != i);
            i5 = f0K2.f8372s;
        }
        return iS2 + i5;
        return Integer.MIN_VALUE;
    }

    public final int v(int i) {
        F0 f0K;
        int i5;
        int i8 = this.f8706f;
        if (i8 < 0) {
            return Integer.MAX_VALUE;
        }
        if (!this.f8703c) {
            int iS = this.f8702b.s(i8);
            if (k(this.f8706f).f7097q == i) {
                return iS;
            }
            int i9 = this.f8706f;
            do {
                i9++;
                if (i9 <= s()) {
                    f0K = k(i9);
                    iS += f0K.f8371r;
                }
            } while (f0K.f7097q != i);
            return iS;
        }
        int iS2 = this.f8702b.s(this.f8707g);
        F0 f0K2 = k(this.f8707g);
        if (f0K2.f7097q == i) {
            i5 = f0K2.f8372s;
        } else {
            int i10 = this.f8707g;
            do {
                i10--;
                if (i10 >= this.f8380k) {
                    iS2 -= f0K2.f8371r;
                    f0K2 = k(i10);
                }
            } while (f0K2.f7097q != i);
            i5 = f0K2.f8372s;
        }
        return iS2 - i5;
        return Integer.MAX_VALUE;
    }

    public final boolean w(int i, boolean z8) {
        int i5;
        int iS;
        int i8;
        C0432j c0432j = this.f8379j;
        if (c0432j.X() != 0) {
            int i9 = this.f8706f;
            if (i9 < 0) {
                int i10 = this.i;
                i5 = i10 != -1 ? i10 : 0;
                if (i5 <= s()) {
                    int i11 = this.f8380k;
                    if (i5 >= i11 - 1) {
                        if (i5 >= i11) {
                            iS = Integer.MAX_VALUE;
                            i8 = 0;
                        }
                    }
                }
                c0432j.U(c0432j.X());
                return false;
            }
            iS = this.f8702b.s(i9);
            i8 = k(this.f8706f).f8371r;
            i5 = this.f8706f - 1;
            int iMax = Math.max(((GridLayoutManager) this.f8702b.f5246r).f8391M, this.f8380k);
            for (int i12 = i5; i12 >= iMax; i12--) {
                F0 f0K = k(i12);
                int i13 = f0K.f7097q;
                P.g gVar = this.f8702b;
                Object[] objArr = this.f8701a;
                int iQ = gVar.q(i12, false, objArr, false);
                if (iQ != f0K.f8372s) {
                    c0432j.U((i12 + 1) - this.f8380k);
                    this.f8380k = this.f8706f;
                    this.f8381l = objArr[0];
                    this.f8382m = iQ;
                    return false;
                }
                this.f8706f = i12;
                if (this.f8707g < 0) {
                    this.f8707g = i12;
                }
                this.f8702b.p(objArr[0], i12, iQ, i13, iS - i8);
                if (z8 || !d(i)) {
                    iS = this.f8702b.s(i12);
                    i8 = f0K.f8371r;
                    if (i13 != 0 || !z8) {
                    }
                }
                return true;
            }
        }
        return false;
    }

    public final int x(int i, int i5, int i8) {
        int i9 = this.f8706f;
        if (i9 >= 0 && (i9 != this.f8380k || i9 != i + 1)) {
            throw new IllegalStateException();
        }
        int i10 = this.f8380k;
        F0 f0K = i10 >= 0 ? k(i10) : null;
        int iS = this.f8702b.s(this.f8380k);
        F0 f02 = new F0(i5, 0);
        C0432j c0432j = this.f8379j;
        int i11 = (c0432j.f8096b - 1) & c0432j.f8098d;
        c0432j.f8096b = i11;
        ((Object[]) c0432j.f8099e)[i11] = f02;
        if (i11 == c0432j.f8097c) {
            c0432j.c();
        }
        Object obj = this.f8381l;
        if (obj != null) {
            f02.f8372s = this.f8382m;
            this.f8381l = null;
        } else {
            P.g gVar = this.f8702b;
            Object[] objArr = this.f8701a;
            f02.f8372s = gVar.q(i, false, objArr, false);
            obj = objArr[0];
        }
        Object obj2 = obj;
        this.f8706f = i;
        this.f8380k = i;
        if (this.f8707g < 0) {
            this.f8707g = i;
        }
        int i12 = !this.f8703c ? i8 - f02.f8372s : i8 + f02.f8372s;
        if (f0K != null) {
            f0K.f8371r = iS - i12;
        }
        this.f8702b.p(obj2, i, f02.f8372s, i5, i12);
        return f02.f8372s;
    }

    /* JADX WARN: Code restructure failed: missing block: B:103:0x012a, code lost:
    
        return true;
     */
    /* JADX WARN: Removed duplicated region for block: B:105:0x012d  */
    /* JADX WARN: Removed duplicated region for block: B:86:0x00fb A[LOOP:2: B:86:0x00fb->B:102:0x011f, LOOP_START, PHI: r5 r8 r9
      0x00fb: PHI (r5v12 int) = (r5v6 int), (r5v17 int) binds: [B:85:0x00f9, B:102:0x011f] A[DONT_GENERATE, DONT_INLINE]
      0x00fb: PHI (r8v19 int) = (r8v17 int), (r8v20 int) binds: [B:85:0x00f9, B:102:0x011f] A[DONT_GENERATE, DONT_INLINE]
      0x00fb: PHI (r9v8 int) = (r9v6 int), (r9v10 int) binds: [B:85:0x00f9, B:102:0x011f] A[DONT_GENERATE, DONT_INLINE]] */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final boolean y(int i, boolean z8) {
        int i5;
        int i8;
        boolean z9;
        int iU;
        int i9;
        int i10;
        int i11 = this.f8706f;
        if (i11 < 0) {
            int i12 = this.i;
            i5 = i12 != -1 ? i12 : 0;
            i8 = (this.f8379j.X() > 0 ? (k(this.f8380k).f7097q + this.f8705e) - 1 : i5) % this.f8705e;
            z9 = false;
            iU = 0;
        } else {
            if (i11 > this.f8380k) {
                return false;
            }
            i5 = i11 - 1;
            i8 = k(i11).f7097q;
            int iR = r(false);
            if (iR < 0) {
                i8--;
                iU = Integer.MAX_VALUE;
                for (int i13 = this.f8705e - 1; i13 >= 0; i13--) {
                    iU = this.f8703c ? u(i13) : v(i13);
                    if (iU != Integer.MAX_VALUE) {
                        break;
                    }
                }
            } else {
                iU = this.f8703c ? f(iR, true, null) : h(iR, false, null);
            }
            if (!this.f8703c ? v(i8) <= iU : u(i8) >= iU) {
                i8--;
                if (i8 < 0) {
                    i8 = this.f8705e - 1;
                    iU = this.f8703c ? g(true, null) : i(false, null);
                }
            }
            z9 = true;
        }
        boolean z10 = false;
        loop1: while (true) {
            if (i8 >= 0) {
                if (i5 < 0 || (!z8 && d(i))) {
                    break;
                }
                int iU2 = this.f8703c ? u(i8) : v(i8);
                if (iU2 == Integer.MAX_VALUE || iU2 == Integer.MIN_VALUE) {
                    if (i8 == this.f8705e - 1) {
                        iU2 = this.f8703c ? u(0) : v(0);
                        if (iU2 != Integer.MAX_VALUE && iU2 != Integer.MIN_VALUE) {
                            if (this.f8703c) {
                                i10 = this.f8704d;
                                iU2 += i10;
                            } else {
                                i9 = this.f8704d;
                                i10 = -i9;
                                iU2 += i10;
                            }
                        }
                    } else {
                        iU2 = this.f8703c ? v(i8 + 1) : u(i8 + 1);
                    }
                    int i14 = i5 - 1;
                    int iX = x(i5, i8, iU2);
                    if (z9) {
                        while (true) {
                            if (!this.f8703c) {
                                if (iU2 - iX <= iU) {
                                    break;
                                }
                                if (i14 < 0) {
                                    break loop1;
                                }
                                break loop1;
                                break loop1;
                            }
                            if (iU2 + iX >= iU) {
                                break;
                            }
                            if (i14 < 0 || (!z8 && d(i))) {
                                break loop1;
                            }
                            iU2 += this.f8703c ? iX + this.f8704d : (-iX) - this.f8704d;
                            int i15 = i14 - 1;
                            int iX2 = x(i14, i8, iU2);
                            i14 = i15;
                            iX = iX2;
                        }
                    } else {
                        z9 = true;
                        iU = this.f8703c ? u(i8) : v(i8);
                    }
                    i5 = i14;
                    i8--;
                    z10 = true;
                } else if (this.f8703c) {
                    i10 = this.f8704d;
                    iU2 += i10;
                    int i142 = i5 - 1;
                    int iX3 = x(i5, i8, iU2);
                    if (z9) {
                    }
                    i5 = i142;
                    i8--;
                    z10 = true;
                } else {
                    i9 = this.f8704d;
                    i10 = -i9;
                    iU2 += i10;
                    int i1422 = i5 - 1;
                    int iX32 = x(i5, i8, iU2);
                    if (z9) {
                    }
                    i5 = i1422;
                    i8--;
                    z10 = true;
                }
            } else {
                if (z8) {
                    break;
                }
                iU = this.f8703c ? g(true, null) : i(false, null);
                i8 = this.f8705e - 1;
            }
        }
        return z10;
    }
}
