/*
 * Decompiled with CFR 0.152.
 */
public class dr
extends fs {
    private final boolean b;
    private final int c;
    private boolean f = false;
    public boolean a = false;

    public dr(boolean bl2) {
        this(bl2, 0);
    }

    public dr(boolean bl2, int n) {
        this.b = bl2;
        this.c = n;
    }

    public final void a(gm gm2) {
        if (!this.f) {
            this.a();
        }
    }

    public final boolean b_(int n) {
        if (super.b_(n)) {
            this.a();
            return true;
        }
        return false;
    }

    public final boolean a(gm gm2, int n) {
        if (super.a(gm2, n)) {
            this.a();
            if (this.a) {
                this.b(gm2);
                this.a();
            }
            return true;
        }
        return false;
    }

    public final void b(int n, int n2) {
        if (this.a) {
            for (n = 0; n < this.m(); ++n) {
                this.b(this.h(n));
            }
            this.a();
        }
    }

    public final int c(int n, int n2) {
        if (false) {
            int n3 = this.m();
            if (n != 1) {
                if (n == 2) {
                    return (n2 + 1) % n3;
                }
                return -1;
            }
            return (n2 + n3 - 1) % n3;
        }
        return super.c(n, n2);
    }

    private void b(gm gm2) {
        this.f = true;
        if (this.b) {
            gm2.m(this.s - gm2.q);
        } else {
            gm2.l(this.r - gm2.p);
        }
        this.f = false;
    }

    private void a() {
        int n = 0;
        int n2 = 0;
        this.f = true;
        if (this.b) {
            int n3;
            for (n3 = 0; n3 < this.m(); ++n3) {
                gm gm2;
                if (n3 != 0) {
                    n += this.c;
                }
                this.h(n3).j(n);
                n += gm2.r;
                n2 = Math.max(n2, gm2.w());
            }
            if (false && this.v != null) {
                int n4 = (this.v.r - n) / 2;
                if (n4 > 0) {
                    for (n3 = 0; n3 < this.m(); ++n3) {
                        gm gm3 = this.h(n3);
                        gm3.j(gm3.p + n4);
                    }
                }
                n += n4;
            }
        } else {
            for (int i = 0; i < this.m(); ++i) {
                gm gm4;
                if (i != 0) {
                    n2 += this.c;
                }
                this.h(i).k(n2);
                n2 += gm4.s;
                n = Math.max(n, gm4.v());
            }
        }
        this.d(this.p, this.q, n, n2);
        this.f = false;
    }
}

