package S6;

/* JADX INFO: loaded from: classes.dex */
public abstract class d {

    /* JADX INFO: renamed from: q, reason: collision with root package name */
    public static final a f6298q;

    static {
        Integer num = K6.a.f3620a;
        f6298q = (num == null || num.intValue() >= 34) ? new T6.a() : new b();
    }

    public abstract int a(int i);

    public abstract int b();

    public abstract long c();

    public long d(long j8) {
        long jC;
        long j9;
        if (j8 <= 0) {
            throw new IllegalArgumentException(("Random range is empty: [" + ((Object) 0L) + ", " + Long.valueOf(j8) + ").").toString());
        }
        if (j8 > 0) {
            if (((-j8) & j8) == j8) {
                int i = (int) j8;
                int i5 = (int) (j8 >>> 32);
                return i != 0 ? ((long) a(31 - Integer.numberOfLeadingZeros(i))) & 4294967295L : i5 == 1 ? ((long) b()) & 4294967295L : (((long) a(31 - Integer.numberOfLeadingZeros(i5))) << 32) + (((long) b()) & 4294967295L);
            }
            do {
                jC = c() >>> 1;
                j9 = jC % j8;
            } while ((j8 - 1) + (jC - j9) < 0);
            return j9;
        }
        while (true) {
            long jC2 = c();
            if (0 <= jC2 && jC2 < j8) {
                return jC2;
            }
        }
    }
}
