package androidx.recyclerview.widget;

import android.view.View;

/* JADX INFO: compiled from: ViewBoundsCheck.java */
/* JADX INFO: loaded from: classes.dex */
class o {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    final b f3001a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    a f3002b = new a();

    /* JADX INFO: compiled from: ViewBoundsCheck.java */
    static class a {

        /* JADX INFO: renamed from: a, reason: collision with root package name */
        int f3003a = 0;

        /* JADX INFO: renamed from: b, reason: collision with root package name */
        int f3004b;

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

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

        /* JADX INFO: renamed from: e, reason: collision with root package name */
        int f3007e;

        a() {
        }

        void a(int i3) {
            this.f3003a = i3 | this.f3003a;
        }

        boolean b() {
            int i3 = this.f3003a;
            if ((i3 & 7) != 0 && (i3 & (c(this.f3006d, this.f3004b) << 0)) == 0) {
                return false;
            }
            int i4 = this.f3003a;
            if ((i4 & 112) != 0 && (i4 & (c(this.f3006d, this.f3005c) << 4)) == 0) {
                return false;
            }
            int i5 = this.f3003a;
            if ((i5 & 1792) != 0 && (i5 & (c(this.f3007e, this.f3004b) << 8)) == 0) {
                return false;
            }
            int i6 = this.f3003a;
            return (i6 & 28672) == 0 || ((c(this.f3007e, this.f3005c) << 12) & i6) != 0;
        }

        int c(int i3, int i4) {
            if (i3 > i4) {
                return 1;
            }
            return i3 == i4 ? 2 : 4;
        }

        void d() {
            this.f3003a = 0;
        }

        void e(int i3, int i4, int i5, int i6) {
            this.f3004b = i3;
            this.f3005c = i4;
            this.f3006d = i5;
            this.f3007e = i6;
        }
    }

    /* JADX INFO: compiled from: ViewBoundsCheck.java */
    interface b {
        View a(int i3);

        int b();

        int c();

        int d(View view);

        int e(View view);
    }

    o(b bVar) {
        this.f3001a = bVar;
    }

    View a(int i3, int i4, int i5, int i6) {
        int iC = this.f3001a.c();
        int iB = this.f3001a.b();
        int i7 = i4 > i3 ? 1 : -1;
        View view = null;
        while (i3 != i4) {
            View viewA = this.f3001a.a(i3);
            this.f3002b.e(iC, iB, this.f3001a.e(viewA), this.f3001a.d(viewA));
            if (i5 != 0) {
                this.f3002b.d();
                this.f3002b.a(i5);
                if (this.f3002b.b()) {
                    return viewA;
                }
            }
            if (i6 != 0) {
                this.f3002b.d();
                this.f3002b.a(i6);
                if (this.f3002b.b()) {
                    view = viewA;
                }
            }
            i3 += i7;
        }
        return view;
    }

    boolean b(View view, int i3) {
        this.f3002b.e(this.f3001a.c(), this.f3001a.b(), this.f3001a.e(view), this.f3001a.d(view));
        if (i3 == 0) {
            return false;
        }
        this.f3002b.d();
        this.f3002b.a(i3);
        return this.f3002b.b();
    }
}
