package defpackage;

import com.google.crypto.tink.shaded.protobuf.CodedOutputStream$OutOfSpaceException;
import java.util.Locale;
import java.util.logging.Logger;

/* JADX INFO: renamed from: ˊᵣʝ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes3.dex */
public final class C1379 {

    /* JADX INFO: renamed from: ᵨᵣ, reason: contains not printable characters */
    public static final Logger f5713 = Logger.getLogger(C1379.class.getName());

    /* JADX INFO: renamed from: ᵻˈᵦʼ, reason: contains not printable characters */
    public static final boolean f5714 = AbstractC4615.f17551;

    /* JADX INFO: renamed from: ʽˈˋ, reason: contains not printable characters */
    public final byte[] f5715;

    /* JADX INFO: renamed from: ːˏᵟᵯ, reason: contains not printable characters */
    public final int f5716;

    /* JADX INFO: renamed from: ᵲᵶᵳˈ, reason: contains not printable characters */
    public ᵟˑʽ f5717;

    /* JADX INFO: renamed from: ᵷᵺʾᵖ, reason: contains not printable characters */
    public int f5718;

    public C1379(int i, byte[] bArr) {
        if (((bArr.length - i) | i) < 0) {
            Locale locale = Locale.US;
            ᵕᵩʽᵲ.ᵮᵣᵗˈ(AbstractC3653.m8230(bArr.length, i, "Array range is invalid. Buffer.length=", ", offset=0, length="));
            throw null;
        }
        this.f5715 = bArr;
        this.f5718 = 0;
        this.f5716 = i;
    }

    /* JADX INFO: renamed from: ʽˈˋ, reason: contains not printable characters */
    public static int m3939(int i) {
        return m3945((i >> 31) ^ (i << 1));
    }

    /* JADX INFO: renamed from: ːˏᵟᵯ, reason: contains not printable characters */
    public static int m3940(long j) {
        return m3943((j >> 63) ^ (j << 1));
    }

    /* JADX INFO: renamed from: ᵨᵣ, reason: contains not printable characters */
    public static int m3941(int i) {
        return m3945(i << 3);
    }

    /* JADX INFO: renamed from: ᵲᵶᵳˈ, reason: contains not printable characters */
    public static int m3942(int i, AbstractC4613 abstractC4613) {
        int iM3941 = m3941(i);
        int size = abstractC4613.size();
        return m3945(size) + size + iM3941;
    }

    /* JADX INFO: renamed from: ᵵᵽ, reason: contains not printable characters */
    public static int m3943(long j) {
        return (640 - (Long.numberOfLeadingZeros(j) * 9)) >>> 6;
    }

    /* JADX INFO: renamed from: ᵷᵺʾᵖ, reason: contains not printable characters */
    public static int m3944(String str) {
        int length;
        try {
            length = AbstractC4937.m10245(str);
        } catch (C1489 unused) {
            length = str.getBytes(AbstractC1130.f4831).length;
        }
        return m3945(length) + length;
    }

    /* JADX INFO: renamed from: ᵻˈᵦʼ, reason: contains not printable characters */
    public static int m3945(int i) {
        return (352 - (Integer.numberOfLeadingZeros(i) * 9)) >>> 6;
    }

    /* JADX INFO: renamed from: ˉᵲ, reason: contains not printable characters */
    public final void m3946(long j, int i) {
        m3952(i, 0);
        m3950(j);
    }

    /* JADX INFO: renamed from: ˊᵙᵾᵲ, reason: contains not printable characters */
    public final void m3947(int i) {
        int i2;
        int i3 = this.f5718;
        while (true) {
            int i4 = i & (-128);
            byte[] bArr = this.f5715;
            if (i4 == 0) {
                i2 = i3 + 1;
                bArr[i3] = (byte) i;
                this.f5718 = i2;
                return;
            } else {
                i2 = i3 + 1;
                try {
                    bArr[i3] = (byte) (i | 128);
                    i >>>= 7;
                    i3 = i2;
                } catch (IndexOutOfBoundsException e) {
                    throw new CodedOutputStream$OutOfSpaceException(i2, this.f5716, 1, e);
                }
            }
            throw new CodedOutputStream$OutOfSpaceException(i2, this.f5716, 1, e);
        }
    }

    /* JADX INFO: renamed from: ˊᵫᵗ, reason: contains not printable characters */
    public final void m3948(byte b) throws CodedOutputStream$OutOfSpaceException {
        int i = this.f5718;
        try {
            int i2 = i + 1;
            try {
                this.f5715[i] = b;
                this.f5718 = i2;
            } catch (IndexOutOfBoundsException e) {
                e = e;
                i = i2;
                throw new CodedOutputStream$OutOfSpaceException(i, this.f5716, 1, e);
            }
        } catch (IndexOutOfBoundsException e2) {
            e = e2;
        }
    }

    /* JADX INFO: renamed from: ˋˈ, reason: contains not printable characters */
    public final void m3949(int i, int i2) throws CodedOutputStream$OutOfSpaceException {
        m3952(i, 0);
        m3953(i2);
    }

    /* JADX INFO: renamed from: ˏːˆ, reason: contains not printable characters */
    public final void m3950(long j) throws CodedOutputStream$OutOfSpaceException {
        int i;
        int i2 = this.f5718;
        boolean z = f5714;
        int i3 = this.f5716;
        byte[] bArr = this.f5715;
        if (!z || i3 - i2 < 10) {
            while ((j & (-128)) != 0) {
                i = i2 + 1;
                try {
                    bArr[i2] = (byte) (((int) j) | 128);
                    j >>>= 7;
                    i2 = i;
                } catch (IndexOutOfBoundsException e) {
                    throw new CodedOutputStream$OutOfSpaceException(i, i3, 1, e);
                }
            }
            i = i2 + 1;
            bArr[i2] = (byte) j;
        } else {
            while ((j & (-128)) != 0) {
                AbstractC4615.m9743(bArr, i2, (byte) (((int) j) | 128));
                j >>>= 7;
                i2++;
            }
            i = i2 + 1;
            AbstractC4615.m9743(bArr, i2, (byte) j);
        }
        this.f5718 = i;
    }

    /* JADX INFO: renamed from: ᵝᵶ, reason: contains not printable characters */
    public final void m3951(long j) throws CodedOutputStream$OutOfSpaceException {
        int i = this.f5718;
        try {
            byte[] bArr = this.f5715;
            bArr[i] = (byte) j;
            bArr[i + 1] = (byte) (j >> 8);
            bArr[i + 2] = (byte) (j >> 16);
            bArr[i + 3] = (byte) (j >> 24);
            bArr[i + 4] = (byte) (j >> 32);
            bArr[i + 5] = (byte) (j >> 40);
            bArr[i + 6] = (byte) (j >> 48);
            bArr[i + 7] = (byte) (j >> 56);
            this.f5718 = i + 8;
        } catch (IndexOutOfBoundsException e) {
            throw new CodedOutputStream$OutOfSpaceException(i, this.f5716, 8, e);
        }
    }

    /* JADX INFO: renamed from: ᵟᵹᵙ, reason: contains not printable characters */
    public final void m3952(int i, int i2) {
        m3947((i << 3) | i2);
    }

    /* JADX INFO: renamed from: ᵪᵹᵥᵻ, reason: contains not printable characters */
    public final void m3953(int i) throws CodedOutputStream$OutOfSpaceException {
        if (i >= 0) {
            m3947(i);
        } else {
            m3950(i);
        }
    }

    /* JADX INFO: renamed from: ᵮᵣᵗˈ, reason: contains not printable characters */
    public final void m3954(long j, int i) {
        m3952(i, 1);
        m3951(j);
    }

    /* JADX INFO: renamed from: ᵱʡˏ, reason: contains not printable characters */
    public final void m3955(int i, int i2) {
        m3952(i, 0);
        m3947(i2);
    }

    /* JADX INFO: renamed from: ᵱᵽʡᵚ, reason: contains not printable characters */
    public final void m3956(int i, int i2) {
        m3952(i, 5);
        m3957(i2);
    }

    /* JADX INFO: renamed from: ᵶᵥᵝ, reason: contains not printable characters */
    public final void m3957(int i) throws CodedOutputStream$OutOfSpaceException {
        int i2 = this.f5718;
        try {
            byte[] bArr = this.f5715;
            bArr[i2] = (byte) i;
            bArr[i2 + 1] = (byte) (i >> 8);
            bArr[i2 + 2] = (byte) (i >> 16);
            bArr[i2 + 3] = (byte) (i >> 24);
            this.f5718 = i2 + 4;
        } catch (IndexOutOfBoundsException e) {
            throw new CodedOutputStream$OutOfSpaceException(i2, this.f5716, 4, e);
        }
    }

    /* JADX INFO: renamed from: ᵻʽᵯ, reason: contains not printable characters */
    public final void m3958(byte[] bArr, int i, int i2) {
        try {
            System.arraycopy(bArr, i, this.f5715, this.f5718, i2);
            this.f5718 += i2;
        } catch (IndexOutOfBoundsException e) {
            throw new CodedOutputStream$OutOfSpaceException(this.f5718, this.f5716, i2, e);
        }
    }
}
