package vl;

/* loaded from: classes3.dex */
public final class b {

    /* renamed from: f, reason: collision with root package name */
    public static final b f40176f = new b(929, 3);

    /* renamed from: a, reason: collision with root package name */
    private final int[] f40177a;

    /* renamed from: b, reason: collision with root package name */
    private final int[] f40178b;

    /* renamed from: c, reason: collision with root package name */
    private final c f40179c;

    /* renamed from: d, reason: collision with root package name */
    private final c f40180d;

    /* renamed from: e, reason: collision with root package name */
    private final int f40181e;

    private b(int i10, int i11) {
        this.f40181e = i10;
        this.f40177a = new int[i10];
        this.f40178b = new int[i10];
        int i12 = 1;
        for (int i13 = 0; i13 < i10; i13++) {
            this.f40177a[i13] = i12;
            i12 = (i12 * i11) % i10;
        }
        for (int i14 = 0; i14 < i10 - 1; i14++) {
            this.f40178b[this.f40177a[i14]] = i14;
        }
        this.f40179c = new c(this, new int[]{0});
        this.f40180d = new c(this, new int[]{1});
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public int a(int i10, int i11) {
        return (i10 + i11) % this.f40181e;
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public c b(int i10, int i11) {
        if (i10 < 0) {
            throw new IllegalArgumentException();
        }
        if (i11 == 0) {
            return this.f40179c;
        }
        int[] iArr = new int[i10 + 1];
        iArr[0] = i11;
        return new c(this, iArr);
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public int c(int i10) {
        return this.f40177a[i10];
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public c d() {
        return this.f40180d;
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public int e() {
        return this.f40181e;
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public c f() {
        return this.f40179c;
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public int g(int i10) {
        if (i10 != 0) {
            return this.f40177a[(this.f40181e - this.f40178b[i10]) - 1];
        }
        throw new ArithmeticException();
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public int h(int i10) {
        if (i10 != 0) {
            return this.f40178b[i10];
        }
        throw new IllegalArgumentException();
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public int i(int i10, int i11) {
        if (i10 == 0 || i11 == 0) {
            return 0;
        }
        int[] iArr = this.f40177a;
        int[] iArr2 = this.f40178b;
        return iArr[(iArr2[i10] + iArr2[i11]) % (this.f40181e - 1)];
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public int j(int i10, int i11) {
        int i12 = this.f40181e;
        return ((i10 + i12) - i11) % i12;
    }
}
