package defpackage;

import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;

/* JADX INFO: renamed from: ʿʠᵚ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes3.dex */
public final class C0360 {

    /* JADX INFO: renamed from: ʽˈˋ, reason: contains not printable characters */
    public final int[] f2164;

    /* JADX INFO: renamed from: ːˏᵟᵯ, reason: contains not printable characters */
    public final int[] f2165;

    /* JADX INFO: renamed from: ᵨᵣ, reason: contains not printable characters */
    public final int f2166;

    /* JADX INFO: renamed from: ᵲᵶᵳˈ, reason: contains not printable characters */
    public final ArrayList f2167;

    /* JADX INFO: renamed from: ᵵᵽ, reason: contains not printable characters */
    public final boolean f2168;

    /* JADX INFO: renamed from: ᵷᵺʾᵖ, reason: contains not printable characters */
    public final ᵣˉ f2169;

    /* JADX INFO: renamed from: ᵻˈᵦʼ, reason: contains not printable characters */
    public final int f2170;

    public C0360(ᵣˉ r11, ArrayList arrayList, int[] iArr, int[] iArr2) {
        int i;
        C0580 c0580;
        int i2;
        this.f2167 = arrayList;
        this.f2164 = iArr;
        this.f2165 = iArr2;
        Arrays.fill(iArr, 0);
        Arrays.fill(iArr2, 0);
        this.f2169 = r11;
        int i3 = r11.ˊᵨᵧ();
        this.f2166 = i3;
        int i4 = r11.ˏːˆ();
        this.f2170 = i4;
        this.f2168 = true;
        C0580 c05802 = arrayList.isEmpty() ? null : (C0580) arrayList.get(0);
        if (c05802 == null || c05802.f2854 != 0 || c05802.f2852 != 0) {
            arrayList.add(0, new C0580(0, 0, 0));
        }
        arrayList.add(new C0580(i3, i4, 0));
        int size = arrayList.size();
        int i5 = 0;
        while (i5 < size) {
            Object obj = arrayList.get(i5);
            i5++;
            C0580 c05803 = (C0580) obj;
            for (int i6 = 0; i6 < c05803.f2853; i6++) {
                int i7 = c05803.f2854 + i6;
                int i8 = c05803.f2852 + i6;
                int i9 = r11.ʽˈˋ(i7, i8) ? 1 : 2;
                iArr[i7] = (i8 << 4) | i9;
                iArr2[i8] = (i7 << 4) | i9;
            }
        }
        if (this.f2168) {
            int size2 = arrayList.size();
            int i10 = 0;
            int i11 = 0;
            while (i11 < size2) {
                Object obj2 = arrayList.get(i11);
                i11++;
                C0580 c05804 = (C0580) obj2;
                while (true) {
                    i = c05804.f2854;
                    if (i10 < i) {
                        if (iArr[i10] == 0) {
                            int size3 = arrayList.size();
                            int i12 = 0;
                            int i13 = 0;
                            while (true) {
                                if (i12 < size3) {
                                    c0580 = (C0580) arrayList.get(i12);
                                    while (true) {
                                        i2 = c0580.f2852;
                                        if (i13 < i2) {
                                            if (iArr2[i13] == 0 && r11.ːˏᵟᵯ(i10, i13)) {
                                                int i14 = r11.ʽˈˋ(i10, i13) ? 8 : 4;
                                                iArr[i10] = (i13 << 4) | i14;
                                                iArr2[i13] = i14 | (i10 << 4);
                                            } else {
                                                i13++;
                                            }
                                        }
                                    }
                                }
                                i13 = c0580.f2853 + i2;
                                i12++;
                            }
                        }
                        i10++;
                    }
                }
                i10 = c05804.f2853 + i;
            }
        }
    }

    /* JADX INFO: renamed from: ʽˈˋ, reason: contains not printable characters */
    public static C0156 m1683(ArrayDeque arrayDeque, int i, boolean z) {
        C0156 c0156;
        Iterator it = arrayDeque.iterator();
        while (true) {
            if (!it.hasNext()) {
                c0156 = null;
                break;
            }
            c0156 = (C0156) it.next();
            if (c0156.f1562 == i && c0156.f1561 == z) {
                it.remove();
                break;
            }
        }
        while (it.hasNext()) {
            C0156 c01562 = (C0156) it.next();
            if (z) {
                c01562.f1560--;
            } else {
                c01562.f1560++;
            }
        }
        return c0156;
    }

    /* JADX INFO: renamed from: ᵲᵶᵳˈ, reason: contains not printable characters */
    public final void m1684(ᵧᵙᵤ r19) {
        int[] iArr;
        ᵣˉ r15;
        int i;
        int i2;
        ArrayList arrayList;
        C0360 c0360 = this;
        C4063 c4063 = new C4063(r19);
        ArrayDeque arrayDeque = new ArrayDeque();
        ArrayList arrayList2 = c0360.f2167;
        boolean z = true;
        int size = arrayList2.size() - 1;
        int i3 = c0360.f2166;
        int i4 = c0360.f2170;
        int i5 = i3;
        while (size >= 0) {
            C0580 c0580 = (C0580) arrayList2.get(size);
            int i6 = c0580.f2854;
            int i7 = c0580.f2853;
            int i8 = i6 + i7;
            int i9 = c0580.f2852;
            int i10 = i9 + i7;
            while (true) {
                iArr = c0360.f2164;
                r15 = c0360.f2169;
                boolean z2 = z;
                i = 0;
                if (i5 <= i8) {
                    break;
                }
                i5--;
                int i11 = iArr[i5];
                if ((i11 & 12) != 0) {
                    arrayList = arrayList2;
                    int i12 = i11 >> 4;
                    C0156 c0156M1683 = m1683(arrayDeque, i12, false);
                    if (c0156M1683 != null) {
                        int i13 = (i3 - c0156M1683.f1560) - 1;
                        c4063.mo8920(i5, i13);
                        if ((i11 & 4) != 0) {
                            c4063.mo8917(i13, z2 ? 1 : 0, r15.ˉᵲ(i5, i12));
                        }
                    } else {
                        arrayDeque.add(new C0156(i5, (i3 - i5) - (z2 ? 1 : 0), z2));
                    }
                } else {
                    arrayList = arrayList2;
                    c4063.mo8918(i5, z2 ? 1 : 0);
                    i3--;
                }
                arrayList2 = arrayList;
                z = true;
            }
            ArrayList arrayList3 = arrayList2;
            while (i4 > i10) {
                i4--;
                int i14 = c0360.f2165[i4];
                if ((i14 & 12) != 0) {
                    int i15 = i14 >> 4;
                    C0156 c0156M16832 = m1683(arrayDeque, i15, true);
                    if (c0156M16832 == null) {
                        arrayDeque.add(new C0156(i4, i3 - i5, false));
                        i2 = 0;
                    } else {
                        i2 = 0;
                        c4063.mo8920((i3 - c0156M16832.f1560) - 1, i5);
                        if ((i14 & 4) != 0) {
                            c4063.mo8917(i5, 1, r15.ˉᵲ(i15, i4));
                        }
                    }
                } else {
                    i2 = i;
                    c4063.mo8916(i5, 1);
                    i3++;
                }
                c0360 = this;
                i = i2;
            }
            int i16 = i9;
            int i17 = i6;
            while (i < i7) {
                if ((iArr[i17] & 15) == 2) {
                    c4063.mo8917(i17, 1, r15.ˉᵲ(i17, i16));
                }
                i17++;
                i16++;
                i++;
            }
            size--;
            c0360 = this;
            z = true;
            i4 = i9;
            i5 = i6;
            arrayList2 = arrayList3;
        }
        c4063.m8919();
    }
}
