package androidx.leanback.widget;

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

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

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

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

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

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

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

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

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

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

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

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

    public final int a() {
        if (this.l) {
            int i6 = this.f11971g;
            int i7 = i6 >= 0 ? this.f11973i - i6 : -i6;
            float f6 = this.f11972h;
            return f6 != -1.0f ? i7 - ((int) ((this.f11973i * f6) / 100.0f)) : i7;
        }
        int i8 = this.f11971g;
        if (i8 < 0) {
            i8 += this.f11973i;
        }
        float f7 = this.f11972h;
        return f7 != -1.0f ? i8 + ((int) ((this.f11973i * f7) / 100.0f)) : i8;
    }

    public final int b(int i6) {
        int i7;
        int i8;
        int i9 = this.f11973i;
        int iA = a();
        int i10 = this.f11966b;
        boolean z6 = i10 == Integer.MIN_VALUE;
        int i11 = this.f11965a;
        boolean z7 = i11 == Integer.MAX_VALUE;
        if (!z6) {
            int i12 = this.f11974j;
            int i13 = iA - i12;
            if (this.l ? (this.f11970f & 2) != 0 : (this.f11970f & 1) != 0) {
                if (i6 - i10 <= i13) {
                    int i14 = i10 - i12;
                    return (z7 || i14 <= (i8 = this.f11967c)) ? i14 : i8;
                }
            }
        }
        if (!z7) {
            int i15 = this.f11975k;
            int i16 = (i9 - iA) - i15;
            if (this.l ? (1 & this.f11970f) != 0 : (this.f11970f & 2) != 0) {
                if (i11 - i6 <= i16) {
                    int i17 = i11 - (i9 - i15);
                    return (z6 || i17 >= (i7 = this.f11968d)) ? i17 : i7;
                }
            }
        }
        return i6 - iA;
    }

    /* JADX WARN: Code restructure failed: missing block: B:17:0x0035, code lost:
    
        r6.f11968d = r0 - r6.f11974j;
     */
    /* JADX WARN: Code restructure failed: missing block: B:27:0x0051, code lost:
    
        r6.f11967c = (r4 - r6.f11974j) - r7;
     */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final void c(int i6, int i7, int i8, int i9) {
        this.f11966b = i6;
        this.f11965a = i7;
        int i10 = (this.f11973i - this.f11974j) - this.f11975k;
        int iA = a();
        int i11 = this.f11966b;
        boolean z6 = i11 == Integer.MIN_VALUE;
        int i12 = this.f11965a;
        boolean z7 = i12 == Integer.MAX_VALUE;
        if (!z6) {
            if (this.l) {
                this.f11968d = i8 - iA;
            } else {
                this.f11968d = i8 - iA;
            }
        }
        if (!z7) {
            if (this.l) {
                this.f11967c = i9 - iA;
            } else {
                this.f11967c = i9 - iA;
            }
        }
        if (z7 || z6) {
            return;
        }
        if (this.l) {
            int i13 = this.f11970f;
            if ((i13 & 1) != 0) {
                if ((this.f11969e & 1) != 0) {
                    this.f11967c = Math.max(this.f11967c, i8 - iA);
                }
                this.f11968d = Math.min(this.f11968d, this.f11967c);
                return;
            } else {
                if ((i13 & 2) != 0) {
                    if ((this.f11969e & 2) != 0) {
                        this.f11968d = Math.min(this.f11968d, i9 - iA);
                    }
                    this.f11967c = Math.max(this.f11968d, this.f11967c);
                    return;
                }
                return;
            }
        }
        int i14 = this.f11970f;
        if ((i14 & 1) != 0) {
            if ((this.f11969e & 1) != 0) {
                this.f11968d = Math.min(this.f11968d, i9 - iA);
            }
            this.f11967c = Math.max(this.f11968d, this.f11967c);
        } else if ((i14 & 2) != 0) {
            if ((this.f11969e & 2) != 0) {
                this.f11967c = Math.max(this.f11967c, i8 - iA);
            }
            this.f11968d = Math.min(this.f11968d, this.f11967c);
        }
    }

    public final String toString() {
        return " min:" + this.f11966b + " " + this.f11968d + " max:" + this.f11965a + " " + this.f11967c;
    }
}
