package p138.p176.p177.p190.p239;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import p138.p176.p177.p190.p239.C4142;

/* JADX INFO: renamed from: ދ.ހ.֏.ؠ.ဢ.ޒ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public class C4142 {

    /* JADX INFO: renamed from: ޅ, reason: contains not printable characters */
    public static final Comparator<C4144> f13234 = new Comparator() { // from class: ދ.ހ.֏.ؠ.ဢ.ؠ
        @Override // java.util.Comparator
        public final int compare(Object obj, Object obj2) {
            return C4142.m6720((C4142.C4144) obj, (C4142.C4144) obj2);
        }
    };

    /* JADX INFO: renamed from: ކ, reason: contains not printable characters */
    public static final Comparator<C4144> f13235 = new Comparator() { // from class: ދ.ހ.֏.ؠ.ဢ.ހ
        @Override // java.util.Comparator
        public final int compare(Object obj, Object obj2) {
            return Float.compare(((C4142.C4144) obj).f13245, ((C4142.C4144) obj2).f13245);
        }
    };

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

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

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

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

    /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
    public final C4144[] f13238 = new C4144[5];

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public final ArrayList<C4144> f13237 = new ArrayList<>();

    /* JADX INFO: renamed from: ށ, reason: contains not printable characters */
    public int f13239 = -1;

    /* JADX INFO: renamed from: ދ.ހ.֏.ؠ.ဢ.ޒ$ؠ, reason: contains not printable characters */
    public static class C4144 {

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

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

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

        public C4144() {
        }

        public /* synthetic */ C4144(C4143 c4143) {
        }
    }

    public C4142(int i) {
        this.f13236 = i;
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public static /* synthetic */ int m6720(C4144 c4144, C4144 c41442) {
        return c4144.f13243 - c41442.f13243;
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public float m6722(float f) {
        if (this.f13239 != 0) {
            Collections.sort(this.f13237, f13235);
            this.f13239 = 0;
        }
        float f2 = f * this.f13241;
        int i = 0;
        for (int i2 = 0; i2 < this.f13237.size(); i2++) {
            C4144 c4144 = this.f13237.get(i2);
            i += c4144.f13244;
            if (i >= f2) {
                return c4144.f13245;
            }
        }
        if (this.f13237.isEmpty()) {
            return Float.NaN;
        }
        return this.f13237.get(r5.size() - 1).f13245;
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public void m6723(int i, float f) {
        C4144 c4144;
        if (this.f13239 != 1) {
            Collections.sort(this.f13237, f13234);
            this.f13239 = 1;
        }
        int i2 = this.f13242;
        if (i2 > 0) {
            C4144[] c4144Arr = this.f13238;
            int i3 = i2 - 1;
            this.f13242 = i3;
            c4144 = c4144Arr[i3];
        } else {
            c4144 = new C4144(null);
        }
        int i4 = this.f13240;
        this.f13240 = i4 + 1;
        c4144.f13243 = i4;
        c4144.f13244 = i;
        c4144.f13245 = f;
        this.f13237.add(c4144);
        this.f13241 += i;
        while (true) {
            int i5 = this.f13241;
            int i6 = this.f13236;
            if (i5 <= i6) {
                return;
            }
            int i7 = i5 - i6;
            C4144 c41442 = this.f13237.get(0);
            int i8 = c41442.f13244;
            if (i8 <= i7) {
                this.f13241 -= i8;
                this.f13237.remove(0);
                int i9 = this.f13242;
                if (i9 < 5) {
                    C4144[] c4144Arr2 = this.f13238;
                    this.f13242 = i9 + 1;
                    c4144Arr2[i9] = c41442;
                }
            } else {
                c41442.f13244 = i8 - i7;
                this.f13241 -= i7;
            }
        }
    }
}
