package p037.p107.p108;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import p138.p139.p143.p144.C2803;

/* JADX INFO: renamed from: މ.ޏ.ށ.ޑ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public class C2339 {

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public static final Comparator<C2346> f7417 = new C2340();

    /* JADX INFO: renamed from: މ.ޏ.ށ.ޑ$֏, reason: contains not printable characters */
    public static class C2340 implements Comparator<C2346> {
        @Override // java.util.Comparator
        public int compare(C2346 c2346, C2346 c23462) {
            C2346 c23463 = c2346;
            C2346 c23464 = c23462;
            int i = c23463.f7432 - c23464.f7432;
            return i == 0 ? c23463.f7433 - c23464.f7433 : i;
        }
    }

    /* JADX INFO: renamed from: މ.ޏ.ށ.ޑ$ؠ, reason: contains not printable characters */
    public static abstract class AbstractC2341 {
        /* JADX INFO: renamed from: ֏ */
        public abstract int mo4198();

        /* JADX INFO: renamed from: ֏ */
        public abstract boolean mo4199(int i, int i2);

        /* JADX INFO: renamed from: ؠ */
        public abstract int mo4200();

        /* JADX INFO: renamed from: ؠ */
        public abstract boolean mo4201(int i, int i2);

        /* JADX INFO: renamed from: ހ */
        public abstract Object mo4202(int i, int i2);
    }

    /* JADX INFO: renamed from: މ.ޏ.ށ.ޑ$ހ, reason: contains not printable characters */
    public static class C2342 {

        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public final List<C2346> f7418;

        /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
        public final int[] f7419;

        /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
        public final int[] f7420;

        /* JADX INFO: renamed from: ށ, reason: contains not printable characters */
        public final AbstractC2341 f7421;

        /* JADX INFO: renamed from: ނ, reason: contains not printable characters */
        public final int f7422;

        /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
        public final int f7423;

        /* JADX INFO: renamed from: ބ, reason: contains not printable characters */
        public final boolean f7424;

        public C2342(AbstractC2341 abstractC2341, List<C2346> list, int[] iArr, int[] iArr2, boolean z) {
            this.f7418 = list;
            this.f7419 = iArr;
            this.f7420 = iArr2;
            Arrays.fill(iArr, 0);
            Arrays.fill(this.f7420, 0);
            this.f7421 = abstractC2341;
            this.f7422 = abstractC2341.mo4200();
            this.f7423 = abstractC2341.mo4198();
            this.f7424 = z;
            C2346 c2346 = this.f7418.isEmpty() ? null : this.f7418.get(0);
            if (c2346 == null || c2346.f7432 != 0 || c2346.f7433 != 0) {
                C2346 c23462 = new C2346();
                c23462.f7432 = 0;
                c23462.f7433 = 0;
                c23462.f7435 = false;
                c23462.f7434 = 0;
                c23462.f7436 = false;
                this.f7418.add(0, c23462);
            }
            int i = this.f7422;
            int i2 = this.f7423;
            for (int size = this.f7418.size() - 1; size >= 0; size--) {
                C2346 c23463 = this.f7418.get(size);
                int i3 = c23463.f7432;
                int i4 = c23463.f7434;
                int i5 = i3 + i4;
                int i6 = c23463.f7433 + i4;
                if (this.f7424) {
                    while (i > i5) {
                        int i7 = i - 1;
                        if (this.f7419[i7] == 0) {
                            m4392(i, i2, size, false);
                        }
                        i = i7;
                    }
                    while (i2 > i6) {
                        int i8 = i2 - 1;
                        if (this.f7420[i8] == 0) {
                            m4392(i, i2, size, true);
                        }
                        i2 = i8;
                    }
                }
                for (int i9 = 0; i9 < c23463.f7434; i9++) {
                    int i10 = c23463.f7432 + i9;
                    int i11 = c23463.f7433 + i9;
                    int i12 = this.f7421.mo4199(i10, i11) ? 1 : 2;
                    this.f7419[i10] = (i11 << 5) | i12;
                    this.f7420[i11] = (i10 << 5) | i12;
                }
                i = c23463.f7432;
                i2 = c23463.f7433;
            }
        }

        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public static C2344 m4390(List<C2344> list, int i, boolean z) {
            int size = list.size() - 1;
            while (size >= 0) {
                C2344 c2344 = list.get(size);
                if (c2344.f7425 == i && c2344.f7427 == z) {
                    list.remove(size);
                    while (size < list.size()) {
                        list.get(size).f7426 += z ? 1 : -1;
                        size++;
                    }
                    return c2344;
                }
                size--;
            }
            return null;
        }

        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public void m4391(InterfaceC2360 interfaceC2360) {
            int i;
            C2346 c2346;
            C2316 c2316 = interfaceC2360 instanceof C2316 ? (C2316) interfaceC2360 : new C2316(interfaceC2360);
            ArrayList arrayList = new ArrayList();
            int i2 = this.f7422;
            int i3 = this.f7423;
            int size = this.f7418.size() - 1;
            while (size >= 0) {
                C2346 c23462 = this.f7418.get(size);
                int i4 = c23462.f7434;
                int i5 = c23462.f7432 + i4;
                int i6 = c23462.f7433 + i4;
                int i7 = 8;
                int i8 = 4;
                if (i5 < i2) {
                    int i9 = i2 - i5;
                    if (this.f7424) {
                        int i10 = i9 - 1;
                        while (i10 >= 0) {
                            int i11 = i5 + i10;
                            int i12 = this.f7419[i11] & 31;
                            if (i12 == 0) {
                                i = size;
                                c2346 = c23462;
                                int i13 = 1;
                                c2316.mo4352(i11, 1);
                                Iterator it = arrayList.iterator();
                                while (it.hasNext()) {
                                    ((C2344) it.next()).f7426 -= i13;
                                    i13 = 1;
                                }
                            } else if (i12 == i8 || i12 == i7) {
                                int i14 = this.f7419[i11] >> 5;
                                C2344 c2344M4390 = m4390(arrayList, i14, false);
                                i = size;
                                c2346 = c23462;
                                c2316.mo4354(i11, c2344M4390.f7426 - 1);
                                if (i12 == 4) {
                                    c2316.mo4353(c2344M4390.f7426 - 1, 1, this.f7421.mo4202(i11, i14));
                                }
                            } else {
                                if (i12 != 16) {
                                    StringBuilder sbM4896 = C2803.m4896("unknown flag for pos ", i11, " ");
                                    sbM4896.append(Long.toBinaryString(i12));
                                    throw new IllegalStateException(sbM4896.toString());
                                }
                                arrayList.add(new C2344(i11, i11, true));
                                i = size;
                                c2346 = c23462;
                            }
                            i10--;
                            i8 = 4;
                            i7 = 8;
                            size = i;
                            c23462 = c2346;
                        }
                    } else {
                        c2316.mo4352(i5, i9);
                    }
                }
                int i15 = size;
                C2346 c23463 = c23462;
                if (i6 < i3) {
                    int i16 = i3 - i6;
                    if (this.f7424) {
                        while (true) {
                            i16--;
                            if (i16 < 0) {
                                break;
                            }
                            int i17 = i6 + i16;
                            int i18 = this.f7420[i17] & 31;
                            if (i18 == 0) {
                                int i19 = 1;
                                c2316.mo4355(i5, 1);
                                Iterator it2 = arrayList.iterator();
                                while (it2.hasNext()) {
                                    ((C2344) it2.next()).f7426 += i19;
                                    i19 = 1;
                                }
                            } else if (i18 == 4 || i18 == 8) {
                                int i20 = this.f7420[i17] >> 5;
                                c2316.mo4354(m4390(arrayList, i20, true).f7426, i5);
                                if (i18 == 4) {
                                    c2316.mo4353(i5, 1, this.f7421.mo4202(i20, i17));
                                }
                            } else {
                                if (i18 != 16) {
                                    StringBuilder sbM48962 = C2803.m4896("unknown flag for pos ", i17, " ");
                                    sbM48962.append(Long.toBinaryString(i18));
                                    throw new IllegalStateException(sbM48962.toString());
                                }
                                arrayList.add(new C2344(i17, i5, false));
                            }
                        }
                    } else {
                        c2316.mo4355(i5, i16);
                    }
                }
                int i21 = i4 - 1;
                while (i21 >= 0) {
                    int[] iArr = this.f7419;
                    C2346 c23464 = c23463;
                    int i22 = c23464.f7432 + i21;
                    if ((iArr[i22] & 31) == 2) {
                        c2316.mo4353(i22, 1, this.f7421.mo4202(i22, c23464.f7433 + i21));
                    }
                    i21--;
                    c23463 = c23464;
                }
                C2346 c23465 = c23463;
                i2 = c23465.f7432;
                i3 = c23465.f7433;
                size = i15 - 1;
            }
            c2316.m4359();
        }

        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public final boolean m4392(int i, int i2, int i3, boolean z) {
            int i4;
            int i5;
            int i6;
            if (z) {
                i2--;
                i5 = i;
                i4 = i2;
            } else {
                i4 = i - 1;
                i5 = i4;
            }
            while (i3 >= 0) {
                C2346 c2346 = this.f7418.get(i3);
                int i7 = c2346.f7432;
                int i8 = c2346.f7434;
                int i9 = i7 + i8;
                int i10 = c2346.f7433 + i8;
                if (z) {
                    for (int i11 = i5 - 1; i11 >= i9; i11--) {
                        if (this.f7421.mo4201(i11, i4)) {
                            i6 = this.f7421.mo4199(i11, i4) ? 8 : 4;
                            this.f7420[i4] = (i11 << 5) | 16;
                            this.f7419[i11] = (i4 << 5) | i6;
                            return true;
                        }
                    }
                } else {
                    for (int i12 = i2 - 1; i12 >= i10; i12--) {
                        if (this.f7421.mo4201(i4, i12)) {
                            i6 = this.f7421.mo4199(i4, i12) ? 8 : 4;
                            int i13 = i - 1;
                            this.f7419[i13] = (i12 << 5) | 16;
                            this.f7420[i12] = (i13 << 5) | i6;
                            return true;
                        }
                    }
                }
                i5 = c2346.f7432;
                i2 = c2346.f7433;
                i3--;
            }
            return false;
        }
    }

    /* JADX INFO: renamed from: މ.ޏ.ށ.ޑ$ށ, reason: contains not printable characters */
    public static abstract class AbstractC2343<T> {
        /* JADX INFO: renamed from: ֏ */
        public abstract boolean mo1574(T t, T t2);

        /* JADX INFO: renamed from: ؠ */
        public abstract boolean mo1575(T t, T t2);

        /* JADX INFO: renamed from: ހ */
        public Object mo2097(T t, T t2) {
            return null;
        }
    }

    /* JADX INFO: renamed from: މ.ޏ.ށ.ޑ$ނ, reason: contains not printable characters */
    public static class C2344 {

        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public int f7425;

        /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
        public int f7426;

        /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
        public boolean f7427;

        public C2344(int i, int i2, boolean z) {
            this.f7425 = i;
            this.f7426 = i2;
            this.f7427 = z;
        }
    }

    /* JADX INFO: renamed from: މ.ޏ.ށ.ޑ$ރ, reason: contains not printable characters */
    public static class C2345 {

        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public int f7428;

        /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
        public int f7429;

        /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
        public int f7430;

        /* JADX INFO: renamed from: ށ, reason: contains not printable characters */
        public int f7431;

        public C2345() {
        }

        public C2345(int i, int i2, int i3, int i4) {
            this.f7428 = i;
            this.f7429 = i2;
            this.f7430 = i3;
            this.f7431 = i4;
        }
    }

    /* JADX INFO: renamed from: މ.ޏ.ށ.ޑ$ބ, reason: contains not printable characters */
    public static class C2346 {

        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public int f7432;

        /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
        public int f7433;

        /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
        public int f7434;

        /* JADX INFO: renamed from: ށ, reason: contains not printable characters */
        public boolean f7435;

        /* JADX INFO: renamed from: ނ, reason: contains not printable characters */
        public boolean f7436;
    }

    /*  JADX ERROR: JadxRuntimeException in pass: RegionMakerVisitor
        jadx.core.utils.exceptions.JadxRuntimeException: Not found exit edge by exit block: B:27:0x00b8
        	at jadx.core.dex.visitors.regions.maker.LoopRegionMaker.checkLoopExits(LoopRegionMaker.java:226)
        	at jadx.core.dex.visitors.regions.maker.LoopRegionMaker.makeLoopRegion(LoopRegionMaker.java:196)
        	at jadx.core.dex.visitors.regions.maker.LoopRegionMaker.process(LoopRegionMaker.java:63)
        	at jadx.core.dex.visitors.regions.maker.RegionMaker.traverse(RegionMaker.java:89)
        	at jadx.core.dex.visitors.regions.maker.RegionMaker.makeRegion(RegionMaker.java:66)
        	at jadx.core.dex.visitors.regions.maker.IfRegionMaker.process(IfRegionMaker.java:96)
        	at jadx.core.dex.visitors.regions.maker.RegionMaker.traverse(RegionMaker.java:106)
        	at jadx.core.dex.visitors.regions.maker.RegionMaker.makeRegion(RegionMaker.java:66)
        	at jadx.core.dex.visitors.regions.maker.IfRegionMaker.process(IfRegionMaker.java:96)
        	at jadx.core.dex.visitors.regions.maker.RegionMaker.traverse(RegionMaker.java:106)
        	at jadx.core.dex.visitors.regions.maker.RegionMaker.makeRegion(RegionMaker.java:66)
        	at jadx.core.dex.visitors.regions.maker.LoopRegionMaker.makeEndlessLoop(LoopRegionMaker.java:282)
        	at jadx.core.dex.visitors.regions.maker.LoopRegionMaker.process(LoopRegionMaker.java:65)
        	at jadx.core.dex.visitors.regions.maker.RegionMaker.traverse(RegionMaker.java:89)
        	at jadx.core.dex.visitors.regions.maker.RegionMaker.makeRegion(RegionMaker.java:66)
        	at jadx.core.dex.visitors.regions.maker.LoopRegionMaker.process(LoopRegionMaker.java:125)
        	at jadx.core.dex.visitors.regions.maker.RegionMaker.traverse(RegionMaker.java:89)
        	at jadx.core.dex.visitors.regions.maker.RegionMaker.makeRegion(RegionMaker.java:66)
        	at jadx.core.dex.visitors.regions.maker.IfRegionMaker.process(IfRegionMaker.java:102)
        	at jadx.core.dex.visitors.regions.maker.RegionMaker.traverse(RegionMaker.java:106)
        	at jadx.core.dex.visitors.regions.maker.RegionMaker.makeRegion(RegionMaker.java:66)
        	at jadx.core.dex.visitors.regions.maker.LoopRegionMaker.process(LoopRegionMaker.java:125)
        	at jadx.core.dex.visitors.regions.maker.RegionMaker.traverse(RegionMaker.java:89)
        	at jadx.core.dex.visitors.regions.maker.RegionMaker.makeRegion(RegionMaker.java:66)
        	at jadx.core.dex.visitors.regions.maker.RegionMaker.makeMthRegion(RegionMaker.java:48)
        	at jadx.core.dex.visitors.regions.RegionMakerVisitor.visit(RegionMakerVisitor.java:25)
        */
    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public static p037.p107.p108.C2339.C2342 m4389(p037.p107.p108.C2339.AbstractC2341 r27) {
        /*
            Method dump skipped, instruction units count: 646
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: p037.p107.p108.C2339.m4389(މ.ޏ.ށ.ޑ$ؠ):މ.ޏ.ށ.ޑ$ހ");
    }
}
