package androidx.leanback.widget;

/* JADX INFO: loaded from: classes.dex */
public final class R0 {

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

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

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

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

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

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public int f8519e = 2;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public int f8520f = 3;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public int f8521g = 0;

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    public float f8522h = 50.0f;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public int f8516b = Integer.MIN_VALUE;

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public int f8515a = Integer.MAX_VALUE;

    public final int a() {
        if (this.f8525l) {
            int i = this.f8521g;
            int i5 = i >= 0 ? this.i - i : -i;
            float f3 = this.f8522h;
            return f3 != -1.0f ? i5 - ((int) ((this.i * f3) / 100.0f)) : i5;
        }
        int i8 = this.f8521g;
        if (i8 < 0) {
            i8 += this.i;
        }
        float f7 = this.f8522h;
        return f7 != -1.0f ? i8 + ((int) ((this.i * f7) / 100.0f)) : i8;
    }

    public final int b(int i) {
        int i5;
        int i8;
        int i9 = this.i;
        int iA = a();
        int i10 = this.f8516b;
        boolean z8 = i10 == Integer.MIN_VALUE;
        int i11 = this.f8515a;
        boolean z9 = i11 == Integer.MAX_VALUE;
        if (!z8) {
            int i12 = this.f8523j;
            int i13 = iA - i12;
            if (this.f8525l ? (this.f8520f & 2) != 0 : (this.f8520f & 1) != 0) {
                if (i - i10 <= i13) {
                    int i14 = i10 - i12;
                    return (z9 || i14 <= (i8 = this.f8517c)) ? i14 : i8;
                }
            }
        }
        if (!z9) {
            int i15 = this.f8524k;
            int i16 = (i9 - iA) - i15;
            if (this.f8525l ? (1 & this.f8520f) != 0 : (this.f8520f & 2) != 0) {
                if (i11 - i <= i16) {
                    int i17 = i11 - (i9 - i15);
                    return (z8 || i17 >= (i5 = this.f8518d)) ? i17 : i5;
                }
            }
        }
        return i - iA;
    }

    /* JADX WARN: Code restructure failed: missing block: B:17:0x0035, code lost:
    
        r6.f8518d = r0 - r6.f8523j;
     */
    /* JADX WARN: Code restructure failed: missing block: B:27:0x0051, code lost:
    
        r6.f8517c = (r4 - r6.f8523j) - r7;
     */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final void c(int i, int i5, int i8, int i9) {
        this.f8516b = i;
        this.f8515a = i5;
        int i10 = (this.i - this.f8523j) - this.f8524k;
        int iA = a();
        int i11 = this.f8516b;
        boolean z8 = i11 == Integer.MIN_VALUE;
        int i12 = this.f8515a;
        boolean z9 = i12 == Integer.MAX_VALUE;
        if (!z8) {
            if (this.f8525l) {
                this.f8518d = i8 - iA;
            } else {
                this.f8518d = i8 - iA;
            }
        }
        if (!z9) {
            if (this.f8525l) {
                this.f8517c = i9 - iA;
            } else {
                this.f8517c = i9 - iA;
            }
        }
        if (z9 || z8) {
            return;
        }
        if (this.f8525l) {
            int i13 = this.f8520f;
            if ((i13 & 1) != 0) {
                if ((this.f8519e & 1) != 0) {
                    this.f8517c = Math.max(this.f8517c, i8 - iA);
                }
                this.f8518d = Math.min(this.f8518d, this.f8517c);
                return;
            } else {
                if ((i13 & 2) != 0) {
                    if ((this.f8519e & 2) != 0) {
                        this.f8518d = Math.min(this.f8518d, i9 - iA);
                    }
                    this.f8517c = Math.max(this.f8518d, this.f8517c);
                    return;
                }
                return;
            }
        }
        int i14 = this.f8520f;
        if ((i14 & 1) != 0) {
            if ((this.f8519e & 1) != 0) {
                this.f8518d = Math.min(this.f8518d, i9 - iA);
            }
            this.f8517c = Math.max(this.f8518d, this.f8517c);
        } else if ((i14 & 2) != 0) {
            if ((this.f8519e & 2) != 0) {
                this.f8517c = Math.max(this.f8517c, i8 - iA);
            }
            this.f8518d = Math.min(this.f8518d, this.f8517c);
        }
    }

    public final String toString() {
        return " min:" + this.f8516b + " " + this.f8518d + " max:" + this.f8515a + " " + this.f8517c;
    }
}
