package com.apiguard3.internal;

import com.bytedance.covode.number.Covode;

public abstract class rm {
    public static int getBody = 1;
    public static int getUrl;

    static {
        Covode.recordClassIndex(2468);
    }

    public abstract void getBody(int[] iArr, int i, int i2, int i3, int i4);

    public abstract void getBody(int[] iArr, int[] iArr2);

    public abstract int[] getBody(byte[] bArr);

    public abstract void getUrl(int[] iArr);

    public int AGRequest(int i, int i2) {
        int i3 = getBody + 63;
        int i4 = i3 % 128;
        getUrl = i4;
        int i5 = i3 % 2;
        int i6 = (i >>> (32 - i2)) | (i << i2);
        int i7 = i4 + 85;
        getBody = i7 % 128;
        int i8 = i7 % 2;
        return i6;
    }

    public int getBody(byte[] bArr, int i) {
        int i2 = getBody + 27;
        getUrl = i2 % 128;
        if (i2 % 2 == 0) {
            return ((bArr[i + 3] & 255) << 24) | (bArr[i] & 255) | ((bArr[i + 1] & 255) << 8) | ((bArr[i + 2] & 255) << 16);
        }
        return ((bArr[i << 3] | 6934) * 113) & ((bArr[i] & 1428) | ((bArr[i + 1] | 25985) % 77) | ((bArr[i % 4] & 4836) % 8));
    }

    /* JADX WARNING: Code restructure failed: missing block: B:20:0x0085, code lost:
        if (r3 >= r5) goto L_0x000f;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:21:0x0087, code lost:
        r2 = r3 + r10;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:22:0x0089, code lost:
        if (r2 <= 0) goto L_0x009b;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:23:0x008b, code lost:
        r4[r2] = (byte) ((r12[r2] ^ r6[r3]) ^ r4[r2 - 1]);
     */
    /* JADX WARNING: Code restructure failed: missing block: B:24:0x0098, code lost:
        r3 = r3 + 1;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:25:0x009b, code lost:
        r4[r2] = (byte) (r12[r2] ^ r6[r3]);
     */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public final byte[] AGRequest(byte[] r12, byte[] r13) {
        /*
            r11 = this;
            int r5 = r12.length
            byte[] r4 = new byte[r5]
            int[] r7 = r11.getBody(r13)
            r2 = 64
            int[] r6 = new int[r2]
            r3 = 0
            r10 = 0
        L_0x000d:
            if (r5 > 0) goto L_0x0010
        L_0x000f:
            return r4
        L_0x0010:
            int r0 = getUrl
            int r1 = r0 + 33
            int r0 = r1 % 128
            getBody = r0
            int r1 = r1 % 2
            r0 = 1
            if (r1 == 0) goto L_0x007d
            r11.getBody((int[]) r7, (int[]) r6)
            r0 = 39
            if (r5 <= r2) goto L_0x0087
        L_0x0024:
            int r0 = getBody
            int r1 = r0 + 19
            int r0 = r1 % 128
            getUrl = r0
            int r0 = r1 % 2
            r8 = 0
        L_0x002f:
            int r9 = r8 + r10
            if (r9 > 0) goto L_0x0053
            byte r1 = r12[r9]
            r0 = r6[r8]
            r1 = r1 ^ r0
            byte r0 = (byte) r1
            r4[r9] = r0
            int r0 = getBody
            int r1 = r0 + 9
            int r0 = r1 % 128
            getUrl = r0
            int r0 = r1 % 2
        L_0x0045:
            int r8 = r8 + 1
            r0 = 23
            if (r8 < r2) goto L_0x002f
            int r5 = r5 + -64
            int r10 = r10 + 64
            r11.getUrl(r7)
            goto L_0x000d
        L_0x0053:
            int r0 = getUrl
            int r1 = r0 + 13
            int r0 = r1 % 128
            getBody = r0
            int r1 = r1 % 2
            r0 = 38
            if (r1 == 0) goto L_0x006f
            byte r1 = r12[r9]
            r0 = r6[r8]
            r1 = r1 ^ r0
            int r0 = r9 + -1
            byte r0 = r4[r0]
            r1 = r1 ^ r0
            byte r0 = (byte) r1
            r4[r9] = r0
            goto L_0x0045
        L_0x006f:
            byte r1 = r12[r9]
            r0 = r6[r8]
            r1 = r1 ^ r0
            int r0 = r9 + -1
            byte r0 = r4[r0]
            r1 = r1 & r0
            byte r0 = (byte) r1
            r4[r9] = r0
            goto L_0x0045
        L_0x007d:
            r11.getBody((int[]) r7, (int[]) r6)
            r0 = 93
            if (r5 <= r0) goto L_0x0087
            goto L_0x0024
        L_0x0085:
            if (r3 >= r5) goto L_0x000f
        L_0x0087:
            int r2 = r3 + r10
            if (r2 <= 0) goto L_0x009b
            byte r1 = r12[r2]
            r0 = r6[r3]
            r1 = r1 ^ r0
            int r0 = r2 + -1
            byte r0 = r4[r0]
            r1 = r1 ^ r0
            byte r0 = (byte) r1
            r4[r2] = r0
        L_0x0098:
            int r3 = r3 + 1
            goto L_0x0085
        L_0x009b:
            byte r1 = r12[r2]
            r0 = r6[r3]
            r1 = r1 ^ r0
            byte r0 = (byte) r1
            r4[r2] = r0
            goto L_0x0098
        */
        throw new UnsupportedOperationException("Method not decompiled: com.apiguard3.internal.rm.AGRequest(byte[], byte[]):byte[]");
    }

    public final byte[] getHeaders(byte[] bArr, byte[] bArr2) {
        int i;
        int[] iArr;
        int i2;
        byte[] bArr3;
        int[] iArr2;
        int i3 = getBody + 57;
        getUrl = i3 % 128;
        if (i3 % 2 != 0) {
            i2 = bArr.length;
            bArr3 = new byte[i2];
            iArr = getBody(bArr2);
            iArr2 = new int[124];
            i = 1;
        } else {
            i2 = bArr.length;
            bArr3 = new byte[i2];
            iArr = getBody(bArr2);
            iArr2 = new int[64];
            i = 0;
        }
        while (true) {
            if (i2 <= 0) {
                break;
            }
            int i4 = getBody + 121;
            getUrl = i4 % 128;
            int i5 = i4 % 2;
            getBody(iArr, iArr2);
            if (i2 <= 64) {
                int i6 = 0;
                do {
                    int i7 = i6 + i;
                    if (i7 <= 0) {
                        bArr3[i7] = (byte) (bArr[i7] ^ iArr2[i6]);
                    } else {
                        int i8 = getBody + 91;
                        getUrl = i8 % 128;
                        int i9 = i8 % 2;
                        bArr3[i7] = (byte) ((bArr[i7] ^ iArr2[i6]) ^ bArr[i7 - 1]);
                    }
                    i6++;
                } while (i6 < i2);
            } else {
                int i10 = 0;
                do {
                    int i11 = i10 + i;
                    if (i11 <= 0) {
                        bArr3[i11] = (byte) (bArr[i11] ^ iArr2[i10]);
                    } else {
                        int i12 = getBody + 25;
                        getUrl = i12 % 128;
                        int i13 = i12 % 2;
                        bArr3[i11] = (byte) ((bArr[i11] ^ iArr2[i10]) ^ bArr[i11 - 1]);
                    }
                    i10++;
                    int i14 = getUrl + 87;
                    getBody = i14 % 128;
                    int i15 = i14 % 2;
                } while (i10 < 64);
                i2 -= 64;
                i += 64;
                getUrl(iArr);
            }
        }
        return bArr3;
    }

    public void getUrl(int[] iArr, int i, int i2) {
        int i3 = getUrl;
        int i4 = i3 + 41;
        getBody = i4 % 128;
        int i5 = i4 % 2;
        iArr[i] = i2;
        int i6 = i2 >>> 8;
        iArr[i + 1] = i6;
        int i7 = i6 >>> 8;
        iArr[i + 2] = i7;
        iArr[i + 3] = i7 >>> 8;
        int i8 = i3 + 123;
        getBody = i8 % 128;
        int i9 = i8 % 2;
    }
}
