package p037.p058.p061;

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

/* JADX INFO: renamed from: މ.ނ.ؠ.ނ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public class C1737 extends C1733 {

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

    /* JADX INFO: renamed from: ބ, reason: contains not printable characters */
    public C1741[] f5666;

    /* JADX INFO: renamed from: ޅ, reason: contains not printable characters */
    public C1741[] f5667;

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

    /* JADX INFO: renamed from: އ, reason: contains not printable characters */
    public C1739 f5669;

    /* JADX INFO: renamed from: ވ, reason: contains not printable characters */
    public C1734 f5670;

    /* JADX INFO: renamed from: މ.ނ.ؠ.ނ$֏, reason: contains not printable characters */
    public class C1738 implements Comparator<C1741> {
        public C1738(C1737 c1737) {
        }

        @Override // java.util.Comparator
        public int compare(C1741 c1741, C1741 c17412) {
            return c1741.f5678 - c17412.f5678;
        }
    }

    /* JADX INFO: renamed from: މ.ނ.ؠ.ނ$ؠ, reason: contains not printable characters */
    public class C1739 implements Comparable {

        /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
        public C1741 f5671;

        public C1739(C1737 c1737) {
        }

        @Override // java.lang.Comparable
        public int compareTo(Object obj) {
            return this.f5671.f5678 - ((C1741) obj).f5678;
        }

        public String toString() {
            String string = "[ ";
            if (this.f5671 != null) {
                for (int i = 0; i < 8; i++) {
                    StringBuilder sbM4889 = C2803.m4889(string);
                    sbM4889.append(this.f5671.f5683[i]);
                    sbM4889.append(" ");
                    string = sbM4889.toString();
                }
            }
            StringBuilder sbM4897 = C2803.m4897(string, "] ");
            sbM4897.append(this.f5671);
            return sbM4897.toString();
        }
    }

    public C1737(C1734 c1734) {
        super(c1734);
        this.f5665 = 128;
        this.f5666 = new C1741[128];
        this.f5667 = new C1741[128];
        this.f5668 = 0;
        this.f5669 = new C1739(this);
        this.f5670 = c1734;
    }

    @Override // p037.p058.p061.C1733, p037.p058.p061.C1735.InterfaceC1736
    public void clear() {
        this.f5668 = 0;
        this.f5641 = 0.0f;
    }

    @Override // p037.p058.p061.C1733
    public String toString() {
        StringBuilder sbM4897 = C2803.m4897("", " goal -> (");
        sbM4897.append(this.f5641);
        sbM4897.append(") : ");
        String string = sbM4897.toString();
        for (int i = 0; i < this.f5668; i++) {
            this.f5669.f5671 = this.f5666[i];
            StringBuilder sbM4889 = C2803.m4889(string);
            sbM4889.append(this.f5669);
            sbM4889.append(" ");
            string = sbM4889.toString();
        }
        return string;
    }

    /* JADX WARN: Code restructure failed: missing block: B:32:0x0055, code lost:
    
        r7 = false;
     */
    /* JADX WARN: Removed duplicated region for block: B:34:0x0058  */
    @Override // p037.p058.p061.C1733, p037.p058.p061.C1735.InterfaceC1736
    /* JADX INFO: renamed from: ֏ */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public C1741 mo3412(C1735 c1735, boolean[] zArr) {
        int i = -1;
        for (int i2 = 0; i2 < this.f5668; i2++) {
            C1741[] c1741Arr = this.f5666;
            C1741 c1741 = c1741Arr[i2];
            if (!zArr[c1741.f5678]) {
                C1739 c1739 = this.f5669;
                c1739.f5671 = c1741;
                int i3 = 7;
                boolean z = true;
                if (i != -1) {
                    C1741 c17412 = c1741Arr[i];
                    if (c1739 == null) {
                        throw null;
                    }
                    while (true) {
                        if (i3 < 0) {
                            break;
                        }
                        float f = c17412.f5683[i3];
                        float f2 = c1739.f5671.f5683[i3];
                        if (f2 == f) {
                            i3--;
                        } else if (f2 >= f) {
                            break;
                        }
                    }
                    if (z) {
                    }
                } else {
                    if (c1739 == null) {
                        throw null;
                    }
                    while (i3 >= 0) {
                        float f3 = c1739.f5671.f5683[i3];
                        if (f3 > 0.0f) {
                            break;
                        }
                        if (f3 < 0.0f) {
                            break;
                        }
                        i3--;
                    }
                    z = false;
                    if (z) {
                        i = i2;
                    }
                }
            }
        }
        if (i == -1) {
            return null;
        }
        return this.f5666[i];
    }

    @Override // p037.p058.p061.C1733
    /* JADX INFO: renamed from: ֏ */
    public void mo3413(C1733 c1733, boolean z) {
        boolean z2;
        C1741 c1741 = c1733.f5640;
        if (c1741 == null) {
            return;
        }
        C1732 c1732 = c1733.f5643;
        int i = c1732.f5637;
        int i2 = c1732.f5629;
        while (i != -1 && i2 > 0) {
            C1732 c17322 = c1733.f5643;
            int i3 = c17322.f5634[i];
            float f = c17322.f5636[i];
            C1741 c17412 = this.f5670.f5647[i3];
            C1739 c1739 = this.f5669;
            c1739.f5671 = c17412;
            boolean z3 = true;
            if (c17412.f5676) {
                for (int i4 = 0; i4 < 8; i4++) {
                    float[] fArr = c1739.f5671.f5683;
                    fArr[i4] = (c1741.f5683[i4] * f) + fArr[i4];
                    if (Math.abs(fArr[i4]) < 1.0E-4f) {
                        c1739.f5671.f5683[i4] = 0.0f;
                    } else {
                        z3 = false;
                    }
                }
                if (z3) {
                    C1737.this.m3439(c1739.f5671);
                }
                z2 = false;
            } else {
                for (int i5 = 0; i5 < 8; i5++) {
                    float f2 = c1741.f5683[i5];
                    if (f2 != 0.0f) {
                        float f3 = f2 * f;
                        if (Math.abs(f3) < 1.0E-4f) {
                            f3 = 0.0f;
                        }
                        c1739.f5671.f5683[i5] = f3;
                    } else {
                        c1739.f5671.f5683[i5] = 0.0f;
                    }
                }
                z2 = true;
            }
            if (z2) {
                m3438(c17412);
            }
            this.f5641 = (c1733.f5641 * f) + this.f5641;
            i = c1733.f5643.f5635[i];
        }
        m3439(c1741);
    }

    @Override // p037.p058.p061.C1733, p037.p058.p061.C1735.InterfaceC1736
    /* JADX INFO: renamed from: ֏ */
    public void mo3414(C1741 c1741) {
        this.f5669.f5671 = c1741;
        Arrays.fill(c1741.f5683, 0.0f);
        c1741.f5683[c1741.f5680] = 1.0f;
        m3438(c1741);
    }

    /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
    public final void m3438(C1741 c1741) {
        int i;
        int i2 = this.f5668 + 1;
        C1741[] c1741Arr = this.f5666;
        if (i2 > c1741Arr.length) {
            C1741[] c1741Arr2 = (C1741[]) Arrays.copyOf(c1741Arr, c1741Arr.length * 2);
            this.f5666 = c1741Arr2;
            this.f5667 = (C1741[]) Arrays.copyOf(c1741Arr2, c1741Arr2.length * 2);
        }
        C1741[] c1741Arr3 = this.f5666;
        int i3 = this.f5668;
        c1741Arr3[i3] = c1741;
        int i4 = i3 + 1;
        this.f5668 = i4;
        if (i4 > 1 && c1741Arr3[i4 - 1].f5678 > c1741.f5678) {
            int i5 = 0;
            while (true) {
                i = this.f5668;
                if (i5 >= i) {
                    break;
                }
                this.f5667[i5] = this.f5666[i5];
                i5++;
            }
            Arrays.sort(this.f5667, 0, i, new C1738(this));
            for (int i6 = 0; i6 < this.f5668; i6++) {
                this.f5666[i6] = this.f5667[i6];
            }
        }
        c1741.f5676 = true;
        c1741.m3443(this);
    }

    /* JADX INFO: renamed from: ށ, reason: contains not printable characters */
    public final void m3439(C1741 c1741) {
        int i = 0;
        while (i < this.f5668) {
            if (this.f5666[i] == c1741) {
                while (true) {
                    int i2 = this.f5668;
                    if (i >= i2 - 1) {
                        this.f5668 = i2 - 1;
                        c1741.f5676 = false;
                        return;
                    } else {
                        C1741[] c1741Arr = this.f5666;
                        int i3 = i + 1;
                        c1741Arr[i] = c1741Arr[i3];
                        i = i3;
                    }
                }
            } else {
                i++;
            }
        }
    }
}
