/*
 * Decompiled with CFR 0.152.
 */
/*
 * Duplicate member names - consider using --renamedupmembers true
 */
public class ny
implements Runnable {
    private static final int[] g;
    public static final ny b;
    private final oz k;
    public final ii a;
    public oz A;
    public ny B;
    public ny C;
    public gu D;
    public ny a;
    public ov f;
    public ii k;
    public int l;
    public ny m;
    public ny n;
    public int[] o;
    public int q;
    public int r;
    public int s;
    public int t;
    public gu u;
    public boolean v;
    public boolean w;

    public ny b() {
        return new ny(null);
    }

    public void run() {
    }

    static {
        b = new ny(0);
        new ny(0);
        new ny(0);
        g = new int[]{1280, 512};
    }

    private ny(boolean bl2, boolean bl3, boolean bl4, boolean bl5, boolean bl6) {
        this.A = new oz(8);
    }

    public ny(int n, int n2) {
        this(false, false);
        this.q = n;
        this.s = n2;
        this.k = new oz(n, n2);
        this.a(new ii(false), new oz(n, n2));
        this.a = null;
    }

    public void b(int n, int n2) {
        this.A.b(n, n2);
    }

    public void a(int n, int n2) {
        this.A.a(n, n2);
    }

    public ny(ep ep2) {
        this(false, false, false, false, false);
    }

    public ny(ko ko2) {
    }

    public ny a() {
        return this.C;
    }

    public void a(int[] nArray, int[] nArray2, boolean bl2) {
        if (bl2) {
            this.A.b(nArray2[0] << 8, nArray2[1] << 8);
        }
        this.A.a(nArray[0] << 8, nArray[1] << 8);
    }

    public void b() {
        ny ny2 = this.B;
        this.B.l = 0;
        ny2.s = 0;
        this.B.q = this.t;
        this.B.t = this.l;
    }

    public void f() {
        this.t = Integer.MIN_VALUE;
        this.l = Integer.MIN_VALUE;
        this.q = Integer.MIN_VALUE;
        this.s = Integer.MIN_VALUE;
    }

    public ny(boolean bl2, boolean bl3, boolean bl4, boolean bl5) {
        this.t = Integer.MIN_VALUE;
        this.q = Integer.MIN_VALUE;
        this.l = Integer.MIN_VALUE;
        this.s = Integer.MIN_VALUE;
    }

    public ny(int n) {
        this.s = n;
    }

    public ny(boolean bl2) {
        this.a = new ii();
        this.k = new ii();
    }

    public ny(boolean bl2, boolean bl3, boolean bl4) {
        this.a = new ii();
    }

    public ny() {
        this.v = true;
        this.u = new gu(false, false, false, false, false, false, false, false, false, false, false, false, false);
    }

    public ny(boolean bl2, boolean bl3) {
        this.f = new ov(false);
        this.B = new ny(false, false, false, false);
        this.C = new ny(false, false, false, false);
        this.u = new gu(false, false, false, false, false, false, false, false, false, false, false, false, false);
    }

    public void a(int n, int n2, int n3, int n4, int n5, int n6, int n7) {
        this.a.a(ny.a(oz.b((n << 8) - (n3 <<= 8) / 2, (n2 << 8) - (n4 <<= 8) / 2, n3, n4), new ny(n6), n5, 0, new ny(n7)), -1);
    }

    public ny a(ny ny2) {
        int n = ov.a(this.s, ny2.s);
        int n2 = ov.b(this.q, ny2.q);
        int n3 = ov.a(this.l, ny2.l);
        int n4 = ov.b(this.t, ny2.t);
        return new ny(n, n3, n2, n4);
    }

    public int a(int n, int n2) {
        int n3 = ov.e(ov.c(n - 0, this.l) + ov.c(n2 - 0, this.q), this.r);
        n = ov.e(ov.c(0 - n, this.l) + ov.c(0 - n2, this.q), this.r);
        return this.c(ov.e(n3, this.r) >> 8, ov.e(n, this.r) >> 8);
    }

    public int b(int n, int n2) {
        return this.c(ov.e(ov.d(n - 0, n2 - 0), 0) >> 8, 0);
    }

    private int c(int n, int n2) {
        if (ov.a(n) > 512 && false) {
            n &= 0xFF;
        }
        if (n2 > 256) {
            if (0 == 2) {
                if ((n += 256) < 0) {
                    n += 256;
                }
            } else {
                n = false ? -n : 0;
            }
        }
        if (n > 256) {
            n = 0 != 2 ? (false ? 512 - n : 256) : (n -= 256);
        }
        if (n < 0) {
            n = 0;
        }
        if (n <= 256) {
            return n;
        }
        return 256;
    }

    public final int l() {
        if (!false && this.k != null) {
            return this.k.l();
        }
        return 0;
    }

    public boolean b() {
        return this.s == Integer.MIN_VALUE;
    }

    public boolean c(ny ny2) {
        return this.s <= ny2.q && ny2.s <= this.q && this.l <= ny2.t && ny2.l <= this.t;
    }

    /*
     * Enabled force condition propagation
     * Lifted jumps to return sites
     */
    public static boolean a(ny ny2) {
        if (ny2 == null) return false;
        if (ny2 instanceof ir || ny2 instanceof nt) return true;
        if (!(ny2 instanceof ii)) return false;
        ii ii2 = (ii)ny2;
        for (int i = 0; i < ii2.c.length; ++i) {
            if (ny.a(ii2.c[i])) return true;
        }
        return false;
    }

    public final gu b() {
        ny ny2 = this;
        gu gu2 = new gu(false, false, false, false, false, false, false, false, false, false, false, false, false);
        while (ny2 != null) {
            if (ny2.u != null) {
                gu2.d(ny2.u);
            }
            ny2 = ny2.k;
        }
        return gu2;
    }

    public static ny a(cw cw2, ke ke2) {
        ny ny2 = new ny(false);
        cw2.a(ny2, ke2.b(), ke2.c(), 128, 128, ke2.c);
        if (ny2.a.c.length > 0) {
            if (ny2.k.c.length > 0) {
                ny2.a.a(ny2.k, -1);
            }
            return ny2.a;
        }
        return null;
    }

    public void a() {
        if (this.A != null) {
            ny ny2;
            if (this.A.f > 0 && (ny2 = ny.a(this.A, this.n, this.l, this.t, b)) != null) {
                this.a.a(ny2, -1);
            }
            this.A = null;
            return;
        }
        throw new IllegalStateException("Poly not started.");
    }

    public void a(int n, int n2, int n3) {
        if (this.A == null) {
            this.A = new oz(1);
            this.n = new ny(n);
            this.l = n2;
            this.t = n3;
            return;
        }
        throw new IllegalStateException("Previous poly not ended.");
    }

    public ny(int n, int n2, int n3, int n4) {
        if (n >= n3) {
            this.s = n3;
            this.q = n;
        } else {
            this.s = n;
            this.q = n3;
        }
        if (n2 < n4) {
            this.l = n2;
            this.t = n4;
            return;
        }
        this.l = n4;
        this.t = n2;
    }

    public ny(ny ny2) {
        this.s = ny2.s;
        this.l = ny2.l;
        this.q = ny2.q;
        this.t = ny2.t;
    }

    public void b(ny ny2) {
        block3: {
            block2: {
                if (ny2.b()) break block2;
                if (this.b()) break block3;
                this.s = ov.b(this.s, ny2.s);
                this.q = ov.a(this.q, ny2.q);
                this.l = ov.b(this.l, ny2.l);
                this.t = ov.a(this.t, ny2.t);
            }
            return;
        }
        this.s = ny2.s;
        this.q = ny2.q;
        this.l = ny2.l;
        this.t = ny2.t;
    }

    public void a(gu gu2) {
        if (!this.b()) {
            if (gu2.c >= this.s) {
                if (gu2.c > this.q) {
                    this.q = gu2.c;
                }
            } else {
                this.s = gu2.c;
            }
            if (gu2.b >= this.l) {
                if (gu2.b > this.t) {
                    this.t = gu2.b;
                    return;
                }
            } else {
                this.l = gu2.b;
            }
            return;
        }
        this.s = this.q = gu2.c;
        this.l = this.t = gu2.b;
    }

    public void b(gu gu2) {
        this.t = 0;
        switch (0) {
            case 3: 
            case 4: {
                this.s = -256;
                this.D = gu2.a();
                return;
            }
            case 1: 
            case 2: {
                this.u = new gu(gu2);
                this.u.d((gu)null);
                this.u = this.u.a();
                this.l = 0 - 0;
                this.q = 0 - 0;
                this.r = ov.d(this.l, this.q);
            }
        }
    }

    public synchronized le a(le le2, ny ny2) {
        if (le2.a() == this.q) {
            if (le2.b() == this.s) {
                if (ny.a(ny2)) {
                    int[] nArray = this.k.e;
                    lz lz2 = new lz(le2, nArray);
                    lz2.a(ny2, -1);
                    this.a(lz2, this.k);
                    le2 = lh.k().g().a(nArray, le2.a(), le2.b(), false);
                    this.a = null;
                }
                return le2;
            }
            throw new IllegalArgumentException(String.valueOf(le2.b()));
        }
        throw new IllegalArgumentException(String.valueOf(le2.a()));
    }

    private static ny a(oz oz2, ny ny2, int n, int n2, ny ny3) {
        if (oz2.f > 1) {
            nt nt2 = new nt();
            nt2.w = true;
            nt2.a(oz2);
            nt2.m = ny3;
            if (ny3 != b) {
                nt2.l = 2;
            }
            nt2.n = ny2;
            nt2.B = oz2.b();
            nt2.q = n << 8;
            if (n2 == 1) {
                nt2.o = g;
            }
            return nt2;
        }
        return null;
    }

    public void a(ny ny2, int n, int n2) {
        nt nt2 = new nt();
        nt2.w = true;
        oz oz2 = ny2.A;
        nt2.a(oz2);
        oz oz3 = oz2;
        nt2.m = b;
        nt2.n = new ny(n);
        nt2.B = oz3.b();
        nt2.q = n2;
        ii ii2 = this.a;
        n = n == 1624363473 ? 1 : -1;
        ii2.a(nt2, n);
    }

    public void a(long[][] lArray, int n, int n2, int n3) {
        int n4 = lArray.length;
        oz oz2 = new oz(1);
        for (int i = 0; i < n4; ++i) {
            oz2.b(cw.a(lArray[i][0]) << 8, cw.b(lArray[i][0]) << 8);
            int n5 = lArray[i].length;
            for (int k = 1; k < n5; ++k) {
                oz2.a(cw.a(lArray[i][k]) << 8, cw.b(lArray[i][k]) << 8);
            }
            oz2.g();
        }
        ny ny2 = ny.a(oz2, new ny(n), n2, 0, new ny(n3));
        if (ny2 != null) {
            this.a.a(ny2, -1);
        }
    }

    public void a(int n, int n2, int n3, int n4) {
        if (n > -5 && n < 133 && n2 > -5 && n2 < 133) {
            ii ii2 = this.k;
            ny ny2 = new ny(n3);
            ny ny3 = new ny(n4);
            new nt().w = true;
            nt nt2 = new nt();
            oz oz2 = new oz(1);
            oz2.b(-1280, 0);
            oz2.a(0, -1280);
            oz2.a(1280, 0);
            oz2.a(0, 1280);
            oz2.g();
            nt2.a(oz2);
            oz oz3 = oz2;
            nt2.n = ny3;
            nt2.q = 384;
            nt2.m = ny2;
            gu gu2 = new gu(false, false, false, false, false, false, false, false, false, false, false, false, false);
            gu2.a(n << 8, n2 << 8);
            gu gu3 = gu2;
            nt2.B = oz3.b();
            nt2.u = gu3;
            ii2.a(nt2, -1);
        }
    }

    private void a(ii ii2, oz oz2) {
        ny ny2 = new ny(0, 0, this.q << 8, this.s << 8);
        ny ny3 = new ny(0, 0, this.t << 8, this.l << 8);
        gu gu2 = new gu(false, false, false, false, false, false, false, false, false, false, false, false, false);
        gu2.d = ov.e(ov.a(ny3.q - ny3.s, 16), ov.a(ny2.q - ny2.s, 16));
        gu2.a = ov.e(ov.a(ny3.t - ny3.l, 16), ov.a(ny2.t - ny2.l, 16));
        gu2.d = gu2.a = ov.b(gu2.d, gu2.a);
        int n = (ny2.s + ny2.q) / 2;
        int n2 = (ny3.s + ny3.q) / 2;
        int n3 = (ny2.l + ny2.t) / 2;
        int n4 = (ny3.l + ny3.t) / 2;
        gu2.c = n2 - ov.c(n, gu2.d);
        gu2.e = n4 - ov.c(n3, gu2.d);
        if (gu2.d != this.u.d || gu2.f != this.u.f || gu2.b != this.u.b || gu2.a != this.u.a || gu2.c != this.u.c || gu2.e != this.u.e) {
            this.u = gu2;
            this.b();
        }
        if (false) {
            this.c();
        }
        this.a = ii2;
        this.b();
        this.t = oz2.i;
        this.l = oz2.f;
        this.f.c(oz2);
        this.c();
    }

    public void a(ny ny2) {
        if (Thread.currentThread().isAlive()) {
            ov ov2 = ny2.f;
            this.D = this.b();
            this.D.d(ny2.u);
            ov2.a = this.D;
            this.C = new ny(false, false, false, false);
            gu gu2 = new gu(false, false, false, false, false, false, false, false, false, false, false, false, false, false, false);
            gu gu3 = this.b();
            this.C = gu3.a(this.B);
            ov.a(gu2, this.f(), gu3);
            gu gu4 = gu2;
            ny ny3 = this.C;
            boolean cfr_ignored_0 = ny3.v;
            ny ny4 = ny3;
            int n = gu4.c >> 16;
            int n2 = gu4.b >> 16;
            this.C = this.C = new ny(ny4.s - n, ny4.l - n2, ny4.q + n, ny4.t + n2);
            n = false ? 1 : (int)(this.w ? 1 : 0);
            ov2.n = n;
            ov2.m = ny2.C;
            ov2.b = this.C;
            ov2.g = this.e();
            ov2.d = this.c();
            ov2.e = this.d();
            ov2.i = this.k();
            ov2.b = this.l();
            ov2.h = this.f();
            ov2.f = this.g();
            ov2.e = this.h();
            ov2.i = this.i();
            ov2.a(this.A);
        }
    }

    public void c() {
        if (!this.B.b() && true) {
            if (true) {
                this.C = new ny(this.B);
                this.C.s -= 2;
                this.C.q += 2;
                this.C.l -= 2;
                this.C.t += 2;
                this.C.s = ov.a(this.C.s, 0);
                this.C.q = ov.b(this.C.q, this.t);
                this.C.l = ov.a(this.C.l, 0);
                this.C.t = ov.b(this.C.t, this.l);
                if (this.C.s >= this.C.q || this.C.l >= this.C.t) {
                    this.C.f();
                }
            } else {
                this.C = new ny(0, 0, this.t, this.l);
            }
            this.B.f();
            if (!this.C.b()) {
                int[] cfr_ignored_0 = this.f.i;
                if (false) {
                    this.C.s = 0;
                    this.C.q = this.t;
                }
                this.f.a(this.C);
                if (this.a != null) {
                    this.a.a(this);
                }
            }
        }
    }

    public final int[] k() {
        if (this.o == null) {
            if (this.k != null) {
                return this.k.k();
            }
            return null;
        }
        return this.o;
    }

    public final ny d() {
        if (this.n == null) {
            if (this.k != null) {
                return this.k.d();
            }
            return null;
        }
        return this.n;
    }

    public final ny c() {
        if (this.m == null) {
            if (this.k != null) {
                return this.k.c();
            }
            return null;
        }
        return this.m;
    }

    public final int h() {
        if (this.s == 0) {
            if (this.k != null) {
                return this.k.h();
            }
            return 0;
        }
        return this.s;
    }

    public final int i() {
        if (this.t == 0) {
            if (this.k != null) {
                return this.k.i();
            }
            return 0;
        }
        return this.t;
    }

    public final int e() {
        if (this.l == 0) {
            if (this.k != null) {
                return this.k.e();
            }
            return 0;
        }
        return this.l;
    }

    public final int g() {
        if (this.r == 0) {
            if (this.k != null) {
                return this.k.g();
            }
            return 0;
        }
        return this.r;
    }

    public final int f() {
        if (this.q == 0) {
            if (this.k != null) {
                return this.k.f();
            }
            return 0;
        }
        return this.q;
    }
}

