package u;

import java.util.ArrayList;

/* JADX INFO: renamed from: u.b, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public class C1028b {

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final C1027a f10017d;

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public f f10014a = null;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public float f10015b = 0.0f;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final ArrayList f10016c = new ArrayList();

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public boolean f10018e = false;

    public C1028b(B2.a aVar) {
        this.f10017d = new C1027a(this, aVar);
    }

    public final void a(c cVar, int i) {
        this.f10017d.g(cVar.j(i), 1.0f);
        this.f10017d.g(cVar.j(i), -1.0f);
    }

    public final void b(f fVar, f fVar2, f fVar3, int i) {
        boolean z5 = false;
        if (i != 0) {
            if (i < 0) {
                i *= -1;
                z5 = true;
            }
            this.f10015b = i;
        }
        if (z5) {
            this.f10017d.g(fVar, 1.0f);
            this.f10017d.g(fVar2, -1.0f);
            this.f10017d.g(fVar3, -1.0f);
        } else {
            this.f10017d.g(fVar, -1.0f);
            this.f10017d.g(fVar2, 1.0f);
            this.f10017d.g(fVar3, 1.0f);
        }
    }

    public final void c(f fVar, f fVar2, f fVar3, int i) {
        boolean z5 = false;
        if (i != 0) {
            if (i < 0) {
                i *= -1;
                z5 = true;
            }
            this.f10015b = i;
        }
        if (z5) {
            this.f10017d.g(fVar, 1.0f);
            this.f10017d.g(fVar2, -1.0f);
            this.f10017d.g(fVar3, 1.0f);
        } else {
            this.f10017d.g(fVar, -1.0f);
            this.f10017d.g(fVar2, 1.0f);
            this.f10017d.g(fVar3, -1.0f);
        }
    }

    public f d(boolean[] zArr) {
        return f(zArr, null);
    }

    public boolean e() {
        return this.f10014a == null && this.f10015b == 0.0f && this.f10017d.d() == 0;
    }

    public final f f(boolean[] zArr, f fVar) {
        int i;
        int iD = this.f10017d.d();
        f fVar2 = null;
        float f6 = 0.0f;
        for (int i5 = 0; i5 < iD; i5++) {
            float f7 = this.f10017d.f(i5);
            if (f7 < 0.0f) {
                f fVarE = this.f10017d.e(i5);
                if ((zArr == null || !zArr[fVarE.f10038l]) && fVarE != fVar && (((i = fVarE.f10046v) == 3 || i == 4) && f7 < f6)) {
                    f6 = f7;
                    fVar2 = fVarE;
                }
            }
        }
        return fVar2;
    }

    public final void g(f fVar) {
        f fVar2 = this.f10014a;
        if (fVar2 != null) {
            this.f10017d.g(fVar2, -1.0f);
            this.f10014a.f10039m = -1;
            this.f10014a = null;
        }
        float fH = this.f10017d.h(fVar, true) * (-1.0f);
        this.f10014a = fVar;
        if (fH == 1.0f) {
            return;
        }
        this.f10015b /= fH;
        C1027a c1027a = this.f10017d;
        int i = c1027a.f10012h;
        for (int i5 = 0; i != -1 && i5 < c1027a.f10005a; i5++) {
            float[] fArr = c1027a.f10011g;
            fArr[i] = fArr[i] / fH;
            i = c1027a.f10010f[i];
        }
    }

    public final void h(c cVar, f fVar, boolean z5) {
        if (fVar == null || !fVar.p) {
            return;
        }
        float fC = this.f10017d.c(fVar);
        this.f10015b = (fVar.f10041o * fC) + this.f10015b;
        this.f10017d.h(fVar, z5);
        if (z5) {
            fVar.b(this);
        }
        if (this.f10017d.d() == 0) {
            this.f10018e = true;
            cVar.f10019a = true;
        }
    }

    public void i(c cVar, C1028b c1028b, boolean z5) {
        C1027a c1027a = this.f10017d;
        c1027a.getClass();
        float fC = c1027a.c(c1028b.f10014a);
        c1027a.h(c1028b.f10014a, z5);
        C1027a c1027a2 = c1028b.f10017d;
        int iD = c1027a2.d();
        for (int i = 0; i < iD; i++) {
            f fVarE = c1027a2.e(i);
            c1027a.a(fVarE, c1027a2.c(fVarE) * fC, z5);
        }
        this.f10015b = (c1028b.f10015b * fC) + this.f10015b;
        if (z5) {
            c1028b.f10014a.b(this);
        }
        if (this.f10014a == null || this.f10017d.d() != 0) {
            return;
        }
        this.f10018e = true;
        cVar.f10019a = true;
    }

    /* JADX WARN: Removed duplicated region for block: B:29:0x007c  */
    /* JADX WARN: Removed duplicated region for block: B:30:0x0081  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct code enable 'Show inconsistent code' option in preferences
    */
    public java.lang.String toString() {
        /*
            r10 = this;
            u.f r0 = r10.f10014a
            if (r0 != 0) goto L7
            java.lang.String r0 = "0"
            goto L17
        L7:
            java.lang.StringBuilder r0 = new java.lang.StringBuilder
            java.lang.String r1 = ""
            r0.<init>(r1)
            u.f r1 = r10.f10014a
            r0.append(r1)
            java.lang.String r0 = r0.toString()
        L17:
            java.lang.String r1 = " = "
            java.lang.String r0 = s0.c.c(r0, r1)
            float r1 = r10.f10015b
            r2 = 0
            int r1 = (r1 > r2 ? 1 : (r1 == r2 ? 0 : -1))
            r3 = 1
            r4 = 0
            if (r1 == 0) goto L35
            java.lang.StringBuilder r0 = u.e.b(r0)
            float r1 = r10.f10015b
            r0.append(r1)
            java.lang.String r0 = r0.toString()
            r1 = r3
            goto L36
        L35:
            r1 = r4
        L36:
            u.a r5 = r10.f10017d
            int r5 = r5.d()
        L3c:
            if (r4 >= r5) goto L9c
            u.a r6 = r10.f10017d
            u.f r6 = r6.e(r4)
            if (r6 != 0) goto L47
            goto L99
        L47:
            u.a r7 = r10.f10017d
            float r7 = r7.f(r4)
            int r8 = (r7 > r2 ? 1 : (r7 == r2 ? 0 : -1))
            if (r8 != 0) goto L52
            goto L99
        L52:
            java.lang.String r6 = r6.toString()
            r9 = -1082130432(0xffffffffbf800000, float:-1.0)
            if (r1 != 0) goto L66
            int r1 = (r7 > r2 ? 1 : (r7 == r2 ? 0 : -1))
            if (r1 >= 0) goto L76
            java.lang.String r1 = "- "
            java.lang.String r0 = s0.c.c(r0, r1)
        L64:
            float r7 = r7 * r9
            goto L76
        L66:
            if (r8 <= 0) goto L6f
            java.lang.String r1 = " + "
            java.lang.String r0 = s0.c.c(r0, r1)
            goto L76
        L6f:
            java.lang.String r1 = " - "
            java.lang.String r0 = s0.c.c(r0, r1)
            goto L64
        L76:
            r1 = 1065353216(0x3f800000, float:1.0)
            int r1 = (r7 > r1 ? 1 : (r7 == r1 ? 0 : -1))
            if (r1 != 0) goto L81
            java.lang.String r0 = s0.c.c(r0, r6)
            goto L98
        L81:
            java.lang.StringBuilder r1 = new java.lang.StringBuilder
            r1.<init>()
            r1.append(r0)
            r1.append(r7)
            java.lang.String r0 = " "
            r1.append(r0)
            r1.append(r6)
            java.lang.String r0 = r1.toString()
        L98:
            r1 = r3
        L99:
            int r4 = r4 + 1
            goto L3c
        L9c:
            if (r1 != 0) goto La4
            java.lang.String r1 = "0.0"
            java.lang.String r0 = s0.c.c(r0, r1)
        La4:
            return r0
        */
        throw new UnsupportedOperationException("Method not decompiled: u.C1028b.toString():java.lang.String");
    }
}
