/*
 * Decompiled with CFR 0.152.
 */
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Vector;

public final class bi {
    private static final String A;
    private static final String B;
    private static final String C;
    private static final String D;
    private static final String E;
    private static final String F;
    private static final String G;
    private static final String H;
    private static final Hashtable I;
    private static final int J;
    private static final Hashtable K;
    private static final String q;
    private static final String r;
    private static final String s;
    private static final String t;
    private static final String u;
    private static final String v;
    private static final String w;
    private static final String x;
    private static final String y;
    private static final String z;
    public static final cq m;
    public static final cq a;
    public static final cq b;
    public static final cq d;
    public static final cq e;
    public static final cq f;
    public static final cq g;
    public static final cq h;
    public static final cq i;
    public static final cq j;
    public static final cq k;
    public static final cq l;
    public static final cq n;
    public static final cq o;
    public static final cq p;
    private final Vector L = new Vector();
    private final Vector M = new Vector(1);
    private final Vector N = new Vector();
    private final int O;
    private final gd P;
    private final hj Q;
    private final lh R;
    public static cq c;
    private hm S;

    public final Vector b() {
        Vector vector = new Vector();
        for (int i = 0; i < this.M.size(); ++i) {
            vector.addElement(this.M.elementAt(i));
        }
        return vector;
    }

    private cq b(int n) {
        return (cq)this.L.elementAt(n);
    }

    public final void h() {
        this.a(iu.g(), e, d);
    }

    public final void f() {
        this.a(this.P.y(), i, h);
    }

    public final void i() {
        this.a(this.P.z(), g, f);
    }

    public final void a(ht ht2) {
        if (this.c()) {
            this.S.a(ht2, 0, 0);
        }
    }

    public final void e() {
        if (this.S != null) {
            this.S.c(false);
            this.S.e(0);
        }
    }

    public final boolean c() {
        return this.S != null && this.S.t;
    }

    /*
     * Enabled aggressive block sorting
     */
    public final boolean a(nj nj2) {
        if (this.S == null || !this.S.t) return false;
        int n = this.S.b(nj2);
        if (n == -1) {
            if (!nj2.j() || this.S.g(nj2.a - this.S.p, nj2.b - this.S.q)) return true;
            this.e();
            return true;
        }
        if (n != -3) return true;
        this.P.a(this.S.f());
        this.e();
        return true;
    }

    public final boolean a(pb pb2) {
        if (this.S != null && this.S.t) {
            if (pb2.c == 8) {
                this.e();
                me.a((short)16, "m", me.a(new String[]{"a=c", "i="}));
                return true;
            }
            if (this.S.a(pb2) == -3) {
                this.P.a(this.S.f());
                this.e();
            }
            return true;
        }
        return false;
    }

    public static void c(cq cq2) {
        Object v2 = I.get(cq2.g);
        if (v2 != null) {
            me.a((short)16, "m", me.a(new String[]{"a=s", "i=" + v2}));
        }
    }

    private void k() {
        Integer n = new Integer(this.L.size());
        if (!this.N.contains(n)) {
            this.N.addElement(n);
        }
    }

    public final void j() {
        if (!lh.A) {
            this.a();
        }
    }

    public final void g() {
        if (!lh.A) {
            if (this.P.B()) {
                this.S.b(j);
                return;
            }
            this.S.a(j);
        }
    }

    private void a(boolean bl2, cq cq2, cq cq3) {
        cq cq4 = !bl2 ? cq3 : cq2;
        if (lh.A) {
            this.Q.b(cq2);
            this.Q.b(cq3);
            this.Q.a(cq4);
            return;
        }
        if (bl2) {
            this.S.a(cq3, cq2);
            return;
        }
        this.S.a(cq2, cq3);
    }

    public bi(gd gd2, hj hj2, boolean bl2, lh lh2) {
        this.P = gd2;
        this.Q = hj2;
        this.R = lh2;
        this.L.addElement(a);
        if (gu.j()) {
            this.L.addElement(b);
        }
        if (lh2.m() && !lh.t()) {
            this.L.addElement(c);
        }
        this.O = 1;
        this.k();
        this.L.addElement(d);
        if (bl2) {
            this.L.addElement(f);
        }
        if (gu.o()) {
            this.L.addElement(h);
        }
        this.k();
        this.L.addElement(j);
        this.L.addElement(k);
        if (!lh.t()) {
            this.L.addElement(l);
        }
        this.L.addElement(n);
        if (lh.b()) {
            this.L.addElement(o);
        }
        this.L.addElement(p);
    }

    static {
        q = lh.d(424);
        r = lh.d(254);
        s = lh.d(417);
        t = lh.d(302);
        u = lh.d(37);
        v = lh.d(458);
        w = lh.d(272);
        x = lh.d(103);
        y = lh.d(592);
        z = lh.d(135);
        A = lh.d(134);
        B = lh.d(353);
        C = lh.d(268);
        D = lh.d(18);
        E = lh.d(461);
        F = lh.d(464);
        G = lh.d(102);
        String string = lh.d(120);
        String string2 = !lh.A ? ps.a('L') : "";
        H = ed.a(string, string2);
        I = new Hashtable();
        I.put(q, new Integer(1));
        I.put(r, new Integer(2));
        I.put(s, new Integer(3));
        I.put(t, new Integer(27));
        I.put(v, new Integer(28));
        I.put(w, new Integer(29));
        I.put(u, new Integer(5));
        I.put(x, new Integer(14));
        I.put(H, new Integer(17));
        I.put(C, new Integer(19));
        I.put(y, new Integer(20));
        I.put(B, new Integer(21));
        I.put(G, new Integer(22));
        I.put(E, new Integer(23));
        I.put(F, new Integer(24));
        I.put(z, new Integer(25));
        I.put(A, new Integer(25));
        I.put(D, new Integer(26));
        J = cq.f;
        string2 = q;
        int n = !lh.t() ? cq.a : cq.f;
        a = cq.a(string2, n, 3);
        b = cq.a(r, J, 5);
        c = cq.a(H, J, 7);
        d = cq.a(z, J, 8);
        e = cq.a(A, J, 8);
        f = cq.a(v, J, 9);
        g = cq.a(w, J, 9);
        h = cq.a(s, J, 10);
        i = cq.a(t, J, 10);
        j = cq.a(u, J, 11);
        k = cq.a(x, J, 20);
        l = cq.a(y, J, 25);
        m = cq.a(B, J, 30);
        bi.n = cq.a(C, cq.d, 35);
        o = cq.a(D, J, 40);
        cq.a("Debug", J, 45);
        cq.a(E, J, 48);
        cq.a(F, J, 49);
        p = cq.a(G, cq.e, 50);
        K = new Hashtable();
        if (!lh.t()) {
            K.put(h, new Character('2'));
            K.put(c, new Character('0'));
            K.put(k, new Character('*'));
            K.put(f, new Character('7'));
        }
    }

    public final void a() {
        if (!lh.A) {
            int n;
            int n2;
            ob ob2 = lh.k().h();
            ps ps2 = ps.a();
            if (lh.t()) {
                n2 = !lh.x ? 1 : 4;
                n = 0x20 | n2;
            } else {
                n2 = !lh.x ? 4 : 1;
                n = 0x20 | n2;
            }
            int n3 = ps2.b - ps2.g;
            w w2 = ob2.a(1, false, false, 0, false);
            int n4 = 4;
            if (lh.t()) {
                w[] wArray = new w[]{ob2.a(3, false, false, 0, false), ob2.a(2, false, false, 0, false), ob2.a(1, false, false, 0, false)};
                if (lh.s()) {
                    n4 = 4 + 9;
                }
                for (n2 = 0; n2 < wArray.length && ((w2 = wArray[n2]).l() + n4) * this.L.size() + 8 >= n3; ++n2) {
                }
            }
            int n5 = 0;
            boolean bl2 = false;
            n4 = Math.min(n4, Math.max((n3 - (w2.l() * this.L.size() + n4 * 2)) / this.L.size(), 0));
            if (this.S != null) {
                bl2 = this.S.t;
                n5 = this.S.g;
            }
            int n6 = ps2.k.c('\ued3e') + 4;
            n2 = !lh.t() ? (lh.x ? 0 : ps2.a) : (!lh.x ? 0 : ps2.a);
            this.S = new hm(null, null, w2, n3, n2, n, n4, n6);
            for (n2 = 0; n2 < this.L.size(); ++n2) {
                cq cq2 = this.b(n2);
                Character c = (Character)K.get(cq2);
                this.S.a(cq2, c, n2);
            }
            this.S.c(bl2);
            this.S.e(n5);
            this.S.f = -14006936;
            this.f();
            this.i();
            this.h();
            this.g();
            return;
        }
        this.S = null;
    }

    public final void d() {
        if (!this.R.m()) {
            if (this.L.contains(c)) {
                cq cq2 = c;
                if (this.L.contains(cq2)) {
                    int n = this.L.indexOf(cq2);
                    this.L.removeElement(cq2);
                    for (int i = 0; i < this.N.size(); ++i) {
                        int n2 = (Integer)this.N.elementAt(i);
                        if (n2 <= n) continue;
                        if (n2 != 1) {
                            this.N.setElementAt(new Integer(n2 - 1), i);
                            continue;
                        }
                        this.N.removeElementAt(i);
                        --i;
                    }
                }
                this.a();
            }
        } else if (!this.L.contains(c)) {
            cq cq3 = c;
            int n = this.O;
            this.L.insertElementAt(cq3, n);
            for (int i = 0; i < this.N.size(); ++i) {
                int n3 = (Integer)this.N.elementAt(i);
                if (n3 <= n) continue;
                this.N.setElementAt(new Integer(n3 + 1), i);
            }
            this.a();
        }
        if (this.S != null) {
            this.S.c(true);
        }
    }

    /*
     * Enabled aggressive block sorting
     * Lifted jumps to return sites
     */
    public final void a(cq cq2) {
        int n;
        if (cq2 != jy.f) {
            this.Q.a(cq2);
            return;
        }
        for (n = 0; n < this.M.size(); ++n) {
            this.Q.b((cq)this.M.elementAt(n));
        }
        this.M.removeAllElements();
        for (n = 0; n < this.L.size(); ++n) {
            cq2 = this.b(n);
            if (!cq2.equals(h)) {
                if (!cq2.equals(f)) {
                    if (cq2.equals(d)) {
                        this.h();
                        continue;
                    }
                    this.Q.a(cq2);
                    continue;
                }
                this.i();
                continue;
            }
            this.f();
        }
        Enumeration enumeration = this.N.elements();
        while (enumeration.hasMoreElements()) {
            ((Integer)enumeration.nextElement()).intValue();
        }
    }

    public final void b(cq cq2) {
        if (cq2 == jy.f) {
            for (int i = 0; i < this.L.size(); ++i) {
                this.Q.b(this.b(i));
            }
            this.Q.b(i);
            this.Q.b(g);
            this.Q.b(e);
            return;
        }
        this.Q.b(cq2);
    }
}

