package d3;

/* JADX INFO: renamed from: d3.a, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public final class C1868a {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public static final C1868a f15507a = new C1868a();

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public static volatile long f15508b = 15000000;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public static double f15509c = 1.5E7d;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public static int f15510d;

    public static final int a() {
        int i6 = C1939y.f16175f;
        long jMaxMemory = Runtime.getRuntime().maxMemory();
        long j4 = (long) (jMaxMemory * (jMaxMemory <= 268435456 ? 0.55d : 0.65d));
        if (j4 < 52428800) {
            j4 = 52428800;
        }
        if (j4 > 2147483647L) {
            j4 = 2147483647L;
        }
        return (int) j4;
    }

    public static void c(long j4) {
        long jX = L4.a.x(j4, 1000000L, 220000000L);
        long j6 = f15508b;
        if (j6 < 1000000) {
            j6 = 1000000;
        }
        boolean z6 = jX < ((long) (((double) j6) / 6.0d));
        int i6 = f15510d;
        double d6 = 0.3d;
        if (i6 >= 6) {
            if (z6) {
                d6 = 0.08d;
            } else if (jX < f15509c) {
                d6 = 0.1d;
            }
        }
        f15510d = i6 + 1;
        double d7 = ((1.0d - d6) * f15509c) + (jX * d6);
        f15509c = d7;
        f15508b = (long) d7;
    }

    /* JADX WARN: Removed duplicated region for block: B:8:0x000f  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public synchronized void b(Long l, Long l6) {
        if (l != null) {
            try {
                if (l.longValue() <= 0) {
                    l = null;
                }
            } catch (Throwable th) {
                throw th;
            }
        }
        long jLongValue = l != null ? l.longValue() : Long.MAX_VALUE;
        if (l6.longValue() <= 0) {
            l6 = null;
        }
        long jMin = Math.min(jLongValue, l6 != null ? l6.longValue() : Long.MAX_VALUE);
        if (jMin == Long.MAX_VALUE) {
            return;
        }
        c(jMin);
    }
}
