package ῲ.ⁱ.ῲ;

import androidx.constraintlayout.solver.SolverVariable;
import java.util.Arrays;
import ඓ.K.K.K.C1293;
import ῲ.ⁱ.ῲ.C2073;

/* renamed from: ῲ.ⁱ.ῲ.K  reason: contains not printable characters */
/* compiled from: ArrayLinkedVariables */
public class C2078 implements C2073.AbstractC2074 {

    /* renamed from: 㑃  reason: contains not printable characters */
    public static float f7150 = 0.001f;

    /* renamed from: ʬ  reason: contains not printable characters */
    public final C2071 f7151;

    /* renamed from: ඓ  reason: contains not printable characters */
    public SolverVariable f7152 = null;

    /* renamed from: ᕣ  reason: contains not printable characters */
    public boolean f7153;

    /* renamed from: ᨨ  reason: contains not printable characters */
    public int f7154;

    /* renamed from: ῲ  reason: contains not printable characters */
    public final C2073 f7155;

    /* renamed from: ⁱ  reason: contains not printable characters */
    public int[] f7156;

    /* renamed from: K  reason: contains not printable characters */
    public int f7157 = 0;

    /* renamed from: 㳳  reason: contains not printable characters */
    public int f7158;

    /* renamed from: 㴹  reason: contains not printable characters */
    public int[] f7159;

    /* renamed from: 㸾  reason: contains not printable characters */
    public int f7160 = 8;

    /* renamed from: 㿎  reason: contains not printable characters */
    public float[] f7161;

    public C2078(C2073 r4, C2071 r5) {
        int i = this.f7160;
        this.f7159 = new int[i];
        this.f7156 = new int[i];
        this.f7161 = new float[i];
        this.f7154 = -1;
        this.f7158 = -1;
        this.f7153 = false;
        this.f7155 = r4;
        this.f7151 = r5;
    }

    @Override // ῲ.ⁱ.ῲ.C2073.AbstractC2074
    public final void clear() {
        int i = this.f7154;
        int i2 = 0;
        while (i != -1 && i2 < this.f7157) {
            SolverVariable solverVariable = this.f7151.f7136[this.f7159[i]];
            if (solverVariable != null) {
                solverVariable.m449(this.f7155);
            }
            i = this.f7156[i];
            i2++;
        }
        this.f7154 = -1;
        this.f7158 = -1;
        this.f7153 = false;
        this.f7157 = 0;
    }

    public String toString() {
        int i = this.f7154;
        String str = "";
        int i2 = 0;
        while (i != -1 && i2 < this.f7157) {
            StringBuilder r1 = C1293.m3416(C1293.m3412(str, " -> "));
            r1.append(this.f7161[i]);
            r1.append(" : ");
            StringBuilder r12 = C1293.m3416(r1.toString());
            r12.append(this.f7151.f7136[this.f7159[i]]);
            str = r12.toString();
            i = this.f7156[i];
            i2++;
        }
        return str;
    }

    @Override // ῲ.ⁱ.ῲ.C2073.AbstractC2074
    /* renamed from: ῲ  reason: contains not printable characters */
    public boolean m5431(SolverVariable solverVariable) {
        int i = this.f7154;
        if (i == -1) {
            return false;
        }
        int i2 = 0;
        while (i != -1 && i2 < this.f7157) {
            if (this.f7159[i] == solverVariable.f789) {
                return true;
            }
            i = this.f7156[i];
            i2++;
        }
        return false;
    }

    @Override // ῲ.ⁱ.ῲ.C2073.AbstractC2074
    /* renamed from: K  reason: contains not printable characters */
    public final void m5438(SolverVariable solverVariable, float f) {
        if (f == 0.0f) {
            m5434(solverVariable, true);
            return;
        }
        int i = this.f7154;
        if (i == -1) {
            this.f7154 = 0;
            float[] fArr = this.f7161;
            int i2 = this.f7154;
            fArr[i2] = f;
            this.f7159[i2] = solverVariable.f789;
            this.f7156[i2] = -1;
            solverVariable.f804++;
            solverVariable.m451(this.f7155);
            this.f7157++;
            if (!this.f7153) {
                this.f7158++;
                int i3 = this.f7158;
                int[] iArr = this.f7159;
                if (i3 >= iArr.length) {
                    this.f7153 = true;
                    this.f7158 = iArr.length - 1;
                    return;
                }
                return;
            }
            return;
        }
        int i4 = 0;
        int i5 = -1;
        while (i != -1 && i4 < this.f7157) {
            int[] iArr2 = this.f7159;
            int i6 = iArr2[i];
            int i7 = solverVariable.f789;
            if (i6 == i7) {
                this.f7161[i] = f;
                return;
            }
            if (iArr2[i] < i7) {
                i5 = i;
            }
            i = this.f7156[i];
            i4++;
        }
        int i8 = this.f7158;
        int i9 = i8 + 1;
        if (this.f7153) {
            int[] iArr3 = this.f7159;
            if (iArr3[i8] != -1) {
                i8 = iArr3.length;
            }
        } else {
            i8 = i9;
        }
        int[] iArr4 = this.f7159;
        if (i8 >= iArr4.length && this.f7157 < iArr4.length) {
            int i10 = 0;
            while (true) {
                int[] iArr5 = this.f7159;
                if (i10 >= iArr5.length) {
                    break;
                } else if (iArr5[i10] == -1) {
                    i8 = i10;
                    break;
                } else {
                    i10++;
                }
            }
        }
        int[] iArr6 = this.f7159;
        if (i8 >= iArr6.length) {
            i8 = iArr6.length;
            this.f7160 *= 2;
            this.f7153 = false;
            this.f7158 = i8 - 1;
            this.f7161 = Arrays.copyOf(this.f7161, this.f7160);
            this.f7159 = Arrays.copyOf(this.f7159, this.f7160);
            this.f7156 = Arrays.copyOf(this.f7156, this.f7160);
        }
        this.f7159[i8] = solverVariable.f789;
        this.f7161[i8] = f;
        if (i5 != -1) {
            int[] iArr7 = this.f7156;
            iArr7[i8] = iArr7[i5];
            iArr7[i5] = i8;
        } else {
            this.f7156[i8] = this.f7154;
            this.f7154 = i8;
        }
        solverVariable.f804++;
        solverVariable.m451(this.f7155);
        this.f7157++;
        if (!this.f7153) {
            this.f7158++;
        }
        if (this.f7157 >= this.f7159.length) {
            this.f7153 = true;
        }
        int i11 = this.f7158;
        int[] iArr8 = this.f7159;
        if (i11 >= iArr8.length) {
            this.f7153 = true;
            this.f7158 = iArr8.length - 1;
        }
    }

    @Override // ῲ.ⁱ.ῲ.C2073.AbstractC2074
    /* renamed from: ῲ  reason: contains not printable characters */
    public int m5429() {
        return this.f7157;
    }

    @Override // ῲ.ⁱ.ῲ.C2073.AbstractC2074
    /* renamed from: ῲ  reason: contains not printable characters */
    public SolverVariable m5430(int i) {
        int i2 = this.f7154;
        int i3 = 0;
        while (i2 != -1 && i3 < this.f7157) {
            if (i3 == i) {
                return this.f7151.f7136[this.f7159[i2]];
            }
            i2 = this.f7156[i2];
            i3++;
        }
        return null;
    }

    @Override // ῲ.ⁱ.ῲ.C2073.AbstractC2074
    /* renamed from: K  reason: contains not printable characters */
    public void m5439(SolverVariable solverVariable, float f, boolean z) {
        float f2 = f7150;
        if (f <= (-f2) || f >= f2) {
            int i = this.f7154;
            if (i == -1) {
                this.f7154 = 0;
                float[] fArr = this.f7161;
                int i2 = this.f7154;
                fArr[i2] = f;
                this.f7159[i2] = solverVariable.f789;
                this.f7156[i2] = -1;
                solverVariable.f804++;
                solverVariable.m451(this.f7155);
                this.f7157++;
                if (!this.f7153) {
                    this.f7158++;
                    int i3 = this.f7158;
                    int[] iArr = this.f7159;
                    if (i3 >= iArr.length) {
                        this.f7153 = true;
                        this.f7158 = iArr.length - 1;
                        return;
                    }
                    return;
                }
                return;
            }
            int i4 = 0;
            int i5 = -1;
            while (i != -1 && i4 < this.f7157) {
                int[] iArr2 = this.f7159;
                int i6 = iArr2[i];
                int i7 = solverVariable.f789;
                if (i6 == i7) {
                    float f3 = this.f7161[i] + f;
                    float f4 = f7150;
                    if (f3 > (-f4) && f3 < f4) {
                        f3 = 0.0f;
                    }
                    this.f7161[i] = f3;
                    if (f3 == 0.0f) {
                        if (i == this.f7154) {
                            this.f7154 = this.f7156[i];
                        } else {
                            int[] iArr3 = this.f7156;
                            iArr3[i5] = iArr3[i];
                        }
                        if (z) {
                            solverVariable.m449(this.f7155);
                        }
                        if (this.f7153) {
                            this.f7158 = i;
                        }
                        solverVariable.f804--;
                        this.f7157--;
                        return;
                    }
                    return;
                }
                if (iArr2[i] < i7) {
                    i5 = i;
                }
                i = this.f7156[i];
                i4++;
            }
            int i8 = this.f7158;
            int i9 = i8 + 1;
            if (this.f7153) {
                int[] iArr4 = this.f7159;
                if (iArr4[i8] != -1) {
                    i8 = iArr4.length;
                }
            } else {
                i8 = i9;
            }
            int[] iArr5 = this.f7159;
            if (i8 >= iArr5.length && this.f7157 < iArr5.length) {
                int i10 = 0;
                while (true) {
                    int[] iArr6 = this.f7159;
                    if (i10 >= iArr6.length) {
                        break;
                    } else if (iArr6[i10] == -1) {
                        i8 = i10;
                        break;
                    } else {
                        i10++;
                    }
                }
            }
            int[] iArr7 = this.f7159;
            if (i8 >= iArr7.length) {
                i8 = iArr7.length;
                this.f7160 *= 2;
                this.f7153 = false;
                this.f7158 = i8 - 1;
                this.f7161 = Arrays.copyOf(this.f7161, this.f7160);
                this.f7159 = Arrays.copyOf(this.f7159, this.f7160);
                this.f7156 = Arrays.copyOf(this.f7156, this.f7160);
            }
            this.f7159[i8] = solverVariable.f789;
            this.f7161[i8] = f;
            if (i5 != -1) {
                int[] iArr8 = this.f7156;
                iArr8[i8] = iArr8[i5];
                iArr8[i5] = i8;
            } else {
                this.f7156[i8] = this.f7154;
                this.f7154 = i8;
            }
            solverVariable.f804++;
            solverVariable.m451(this.f7155);
            this.f7157++;
            if (!this.f7153) {
                this.f7158++;
            }
            int i11 = this.f7158;
            int[] iArr9 = this.f7159;
            if (i11 >= iArr9.length) {
                this.f7153 = true;
                this.f7158 = iArr9.length - 1;
            }
        }
    }

    @Override // ῲ.ⁱ.ῲ.C2073.AbstractC2074
    /* renamed from: K  reason: contains not printable characters */
    public float m5435(C2073 r6, boolean z) {
        float r0 = m5433(r6.f7140);
        m5434(r6.f7140, z);
        C2073.AbstractC2074 k = r6.f7138;
        int r1 = k.m5411();
        for (int i = 0; i < r1; i++) {
            SolverVariable r3 = k.m5412(i);
            m5439(r3, k.m5415(r3) * r0, z);
        }
        return r0;
    }

    @Override // ῲ.ⁱ.ῲ.C2073.AbstractC2074
    /* renamed from: K  reason: contains not printable characters */
    public final float m5434(SolverVariable solverVariable, boolean z) {
        if (this.f7152 == solverVariable) {
            this.f7152 = null;
        }
        int i = this.f7154;
        if (i == -1) {
            return 0.0f;
        }
        int i2 = 0;
        int i3 = -1;
        while (i != -1 && i2 < this.f7157) {
            if (this.f7159[i] == solverVariable.f789) {
                if (i == this.f7154) {
                    this.f7154 = this.f7156[i];
                } else {
                    int[] iArr = this.f7156;
                    iArr[i3] = iArr[i];
                }
                if (z) {
                    solverVariable.m449(this.f7155);
                }
                solverVariable.f804--;
                this.f7157--;
                this.f7159[i] = -1;
                if (this.f7153) {
                    this.f7158 = i;
                }
                return this.f7161[i];
            }
            i2++;
            i3 = i;
            i = this.f7156[i];
        }
        return 0.0f;
    }

    @Override // ῲ.ⁱ.ῲ.C2073.AbstractC2074
    /* renamed from: K  reason: contains not printable characters */
    public void m5436() {
        int i = this.f7154;
        int i2 = 0;
        while (i != -1 && i2 < this.f7157) {
            float[] fArr = this.f7161;
            fArr[i] = fArr[i] * -1.0f;
            i = this.f7156[i];
            i2++;
        }
    }

    @Override // ῲ.ⁱ.ῲ.C2073.AbstractC2074
    /* renamed from: K  reason: contains not printable characters */
    public void m5437(float f) {
        int i = this.f7154;
        int i2 = 0;
        while (i != -1 && i2 < this.f7157) {
            float[] fArr = this.f7161;
            fArr[i] = fArr[i] / f;
            i = this.f7156[i];
            i2++;
        }
    }

    @Override // ῲ.ⁱ.ῲ.C2073.AbstractC2074
    /* renamed from: K  reason: contains not printable characters */
    public float m5432(int i) {
        int i2 = this.f7154;
        int i3 = 0;
        while (i2 != -1 && i3 < this.f7157) {
            if (i3 == i) {
                return this.f7161[i2];
            }
            i2 = this.f7156[i2];
            i3++;
        }
        return 0.0f;
    }

    @Override // ῲ.ⁱ.ῲ.C2073.AbstractC2074
    /* renamed from: K  reason: contains not printable characters */
    public final float m5433(SolverVariable solverVariable) {
        int i = this.f7154;
        int i2 = 0;
        while (i != -1 && i2 < this.f7157) {
            if (this.f7159[i] == solverVariable.f789) {
                return this.f7161[i];
            }
            i = this.f7156[i];
            i2++;
        }
        return 0.0f;
    }
}
