package o; import com.google.common.base.Ascii; import com.google.common.primitives.UnsignedBytes; import com.google.protobuf.InvalidProtocolBufferException; import java.io.IOException; import o.KUw; import o.MTP; import o.ZjA; /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes2.dex */ public final class sjx { sjx() { } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes2.dex */ public static final class LWm { public long a; public Object b; public int d; public final ZjA e; LWm() { this.e = ZjA.e(); } /* JADX INFO: Access modifiers changed from: package-private */ public LWm(ZjA zjA) { this.e = zjA; } } /* JADX INFO: Access modifiers changed from: package-private */ public static int b(int i, byte[] bArr, int i2, LWm lWm) { int i3 = i & 127; int i4 = i2 + 1; byte b = bArr[i2]; if (b >= 0) { lWm.d = i3 | (b << 7); return i4; } int i5 = i3 | ((b & Ascii.DEL) << 7); int i6 = i2 + 2; byte b2 = bArr[i4]; if (b2 >= 0) { lWm.d = i5 | (b2 << 14); return i6; } int i7 = i5 | ((b2 & Ascii.DEL) << 14); int i8 = i2 + 3; byte b3 = bArr[i6]; if (b3 >= 0) { lWm.d = i7 | (b3 << Ascii.NAK); return i8; } int i9 = i7 | ((b3 & Ascii.DEL) << 21); int i10 = i2 + 4; byte b4 = bArr[i8]; if (b4 >= 0) { lWm.d = i9 | (b4 << 28); return i10; } while (true) { int i11 = i10 + 1; if (bArr[i10] >= 0) { lWm.d = i9 | ((b4 & Ascii.DEL) << 28); return i11; } i10 = i11; } } /* JADX INFO: Access modifiers changed from: package-private */ public static int e(byte[] bArr, int i, LWm lWm) { int i2 = i + 1; long j = bArr[i]; if (j >= 0) { lWm.a = j; return i2; } return c(j, bArr, i2, lWm); } private static int c(long j, byte[] bArr, int i, LWm lWm) { int i2 = i + 1; byte b = bArr[i]; long j2 = (j & 127) | ((b & Ascii.DEL) << 7); int i3 = 7; while (b < 0) { b = bArr[i2]; i3 += 7; j2 |= (b & Ascii.DEL) << i3; i2++; } lWm.a = j2; return i2; } /* JADX INFO: Access modifiers changed from: package-private */ public static int d(byte[] bArr, int i) { return ((bArr[i + 3] & UnsignedBytes.MAX_VALUE) << 24) | (bArr[i] & UnsignedBytes.MAX_VALUE) | ((bArr[i + 1] & UnsignedBytes.MAX_VALUE) << 8) | ((bArr[i + 2] & UnsignedBytes.MAX_VALUE) << 16); } /* JADX INFO: Access modifiers changed from: package-private */ public static long c(byte[] bArr, int i) { return (bArr[i] & 255) | ((bArr[i + 1] & 255) << 8) | ((bArr[i + 2] & 255) << 16) | ((bArr[i + 3] & 255) << 24) | ((bArr[i + 4] & 255) << 32) | ((bArr[i + 5] & 255) << 40) | ((bArr[i + 6] & 255) << 48) | ((bArr[i + 7] & 255) << 56); } /* JADX INFO: Access modifiers changed from: package-private */ public static int a(Wnq wnq, byte[] bArr, int i, int i2, LWm lWm) throws IOException { int i3 = i + 1; int i4 = bArr[i]; if (i4 < 0) { i3 = b(i4, bArr, i3, lWm); i4 = lWm.d; } int i5 = i3; if (i4 < 0 || i4 > i2 - i5) { throw InvalidProtocolBufferException.g(); } Object e = wnq.e(); int i6 = i4 + i5; wnq.d(e, bArr, i5, i6, lWm); wnq.e(e); lWm.b = e; return i6; } /* JADX INFO: Access modifiers changed from: package-private */ public static int e(Wnq wnq, byte[] bArr, int i, int i2, int i3, LWm lWm) throws IOException { C5290bqJ c5290bqJ = (C5290bqJ) wnq; Object d = c5290bqJ.b.d(c5290bqJ.c); int d2 = c5290bqJ.d((C5290bqJ) d, bArr, i, i2, i3, lWm); c5290bqJ.e((C5290bqJ) d); lWm.b = d; return d2; } /* JADX INFO: Access modifiers changed from: package-private */ public static int b(int i, byte[] bArr, int i2, int i3, MTP.RVV rvv, LWm lWm) { Rjv rjv = (Rjv) rvv; int i4 = i2 + 1; byte b = bArr[i2]; if (b >= 0) { lWm.d = b; } else { i4 = b(b, bArr, i4, lWm); } rjv.a(lWm.d); while (i4 < i3) { int i5 = i4 + 1; byte b2 = bArr[i4]; if (b2 >= 0) { lWm.d = b2; } else { i5 = b(b2, bArr, i5, lWm); } if (i != lWm.d) { break; } i4 = i5 + 1; byte b3 = bArr[i5]; if (b3 >= 0) { lWm.d = b3; } else { i4 = b(b3, bArr, i4, lWm); } rjv.a(lWm.d); } return i4; } /* JADX INFO: Access modifiers changed from: package-private */ public static int d(byte[] bArr, int i, MTP.RVV rvv, LWm lWm) throws IOException { Rjv rjv = (Rjv) rvv; int i2 = i + 1; byte b = bArr[i]; if (b >= 0) { lWm.d = b; } else { i2 = b(b, bArr, i2, lWm); } int i3 = lWm.d + i2; while (i2 < i3) { int i4 = i2 + 1; byte b2 = bArr[i2]; if (b2 >= 0) { lWm.d = b2; i2 = i4; } else { i2 = b(b2, bArr, i4, lWm); } rjv.a(lWm.d); } if (i2 == i3) { return i2; } throw InvalidProtocolBufferException.g(); } /* JADX INFO: Access modifiers changed from: package-private */ public static int c(Wnq wnq, int i, byte[] bArr, int i2, int i3, MTP.RVV rvv, LWm lWm) throws IOException { int a = a(wnq, bArr, i2, i3, lWm); rvv.add(lWm.b); while (a < i3) { int i4 = a + 1; byte b = bArr[a]; if (b >= 0) { lWm.d = b; } else { i4 = b(b, bArr, i4, lWm); } if (i != lWm.d) { break; } a = a(wnq, bArr, i4, i3, lWm); rvv.add(lWm.b); } return a; } /* JADX INFO: Access modifiers changed from: package-private */ public static int c(int i, byte[] bArr, int i2, int i3, Object obj, InterfaceC16581pUl interfaceC16581pUl, LWm lWm) throws IOException { KUw.IeS ieS = lWm.e.a.get(new ZjA.LWm(interfaceC16581pUl, i >>> 3)); if (ieS == null) { return d(i, bArr, i2, i3, C5290bqJ.d(obj), lWm); } KUw.Sts sts = (KUw.Sts) obj; sts.c(); Rkw rkw = sts.extensions; KUw.RVV rvv = ieS.d; throw null; } /* JADX INFO: Access modifiers changed from: package-private */ public static int d(int i, byte[] bArr, int i2, int i3, C0526IsC c0526IsC, LWm lWm) throws InvalidProtocolBufferException { int b; if (Nvr.b(i) == 0) { throw InvalidProtocolBufferException.d(); } int c = Nvr.c(i); if (c == 0) { int e = e(bArr, i2, lWm); c0526IsC.a(i, Long.valueOf(lWm.a)); return e; } if (c == 1) { c0526IsC.a(i, Long.valueOf(c(bArr, i2))); return i2 + 8; } if (c == 2) { int i4 = i2 + 1; byte b2 = bArr[i2]; if (b2 >= 0) { lWm.d = b2; } else { i4 = b(b2, bArr, i4, lWm); } int i5 = lWm.d; if (i5 < 0) { throw InvalidProtocolBufferException.i(); } if (i5 > bArr.length - i4) { throw InvalidProtocolBufferException.g(); } if (i5 == 0) { c0526IsC.a(i, QwV.a); } else { c0526IsC.a(i, QwV.c(bArr, i4, i5)); } return i4 + i5; } if (c != 3) { if (c == 5) { c0526IsC.a(i, Integer.valueOf(d(bArr, i2))); return i2 + 4; } throw InvalidProtocolBufferException.d(); } C0526IsC e2 = C0526IsC.e(); int i6 = (i & (-8)) | 4; int i7 = 0; while (true) { if (i2 >= i3) { break; } int i8 = i2 + 1; byte b3 = bArr[i2]; if (b3 >= 0) { lWm.d = b3; b = i8; } else { b = b(b3, bArr, i8, lWm); } int i9 = lWm.d; if (i9 == i6) { i7 = i9; i2 = b; break; } i7 = i9; i2 = d(i9, bArr, b, i3, e2, lWm); } if (i2 > i3 || i7 != i6) { throw InvalidProtocolBufferException.f(); } c0526IsC.a(i, e2); return i2; } /* JADX INFO: Access modifiers changed from: package-private */ public static int c(int i, byte[] bArr, int i2, int i3, LWm lWm) throws InvalidProtocolBufferException { if (Nvr.b(i) == 0) { throw InvalidProtocolBufferException.d(); } int c = Nvr.c(i); if (c == 0) { return e(bArr, i2, lWm); } if (c == 1) { return i2 + 8; } if (c == 2) { int i4 = i2 + 1; byte b = bArr[i2]; if (b >= 0) { lWm.d = b; } else { i4 = b(b, bArr, i4, lWm); } return i4 + lWm.d; } if (c != 3) { if (c == 5) { return i2 + 4; } throw InvalidProtocolBufferException.d(); } int i5 = (i & (-8)) | 4; int i6 = 0; while (i2 < i3) { int i7 = i2 + 1; byte b2 = bArr[i2]; if (b2 >= 0) { lWm.d = b2; i2 = i7; } else { i2 = b(b2, bArr, i7, lWm); } i6 = lWm.d; if (i6 == i5) { break; } i2 = c(i6, bArr, i2, i3, lWm); } if (i2 > i3 || i6 != i5) { throw InvalidProtocolBufferException.f(); } return i2; } /* JADX INFO: Access modifiers changed from: package-private */ public static int b(byte[] bArr, int i, LWm lWm) throws InvalidProtocolBufferException { int i2 = i + 1; byte b = bArr[i]; if (b >= 0) { lWm.d = b; } else { i2 = b(b, bArr, i2, lWm); } int i3 = lWm.d; if (i3 < 0) { throw InvalidProtocolBufferException.i(); } if (i3 > bArr.length - i2) { throw InvalidProtocolBufferException.g(); } if (i3 == 0) { lWm.b = QwV.a; return i2; } lWm.b = QwV.c(bArr, i2, i3); return i2 + i3; } /* JADX INFO: Access modifiers changed from: package-private */ public static int c(byte[] bArr, int i, LWm lWm) throws InvalidProtocolBufferException { int i2 = i + 1; byte b = bArr[i]; if (b >= 0) { lWm.d = b; } else { i2 = b(b, bArr, i2, lWm); } int i3 = lWm.d; if (i3 < 0) { throw InvalidProtocolBufferException.i(); } if (i3 == 0) { lWm.b = ""; return i2; } lWm.b = new String(bArr, i2, i3, MTP.b); return i2 + i3; } /* JADX INFO: Access modifiers changed from: package-private */ public static int a(byte[] bArr, int i, LWm lWm) throws InvalidProtocolBufferException { int i2 = i + 1; byte b = bArr[i]; if (b >= 0) { lWm.d = b; } else { i2 = b(b, bArr, i2, lWm); } int i3 = lWm.d; if (i3 < 0) { throw InvalidProtocolBufferException.i(); } if (i3 == 0) { lWm.b = ""; return i2; } lWm.b = C16752qto.d(bArr, i2, i3); return i2 + i3; } }