package com.fyber.inneractive.sdk.protobuf; import com.fyber.inneractive.sdk.protobuf.z; import com.ironsource.mediationsdk.logger.IronSourceError; import java.io.IOException; import java.util.Arrays; /* loaded from: classes2.dex */ public final class l1 { public static final l1 f = new l1(0, new int[0], new Object[0], false); public int a; public int[] b; public Object[] c; public int d; public boolean e; public l1() { this(0, new int[8], new Object[8], true); } public static l1 a(l1 l1Var, l1 l1Var2) { int i = l1Var.a + l1Var2.a; int[] copyOf = Arrays.copyOf(l1Var.b, i); System.arraycopy(l1Var2.b, 0, copyOf, l1Var.a, l1Var2.a); Object[] copyOf2 = Arrays.copyOf(l1Var.c, i); System.arraycopy(l1Var2.c, 0, copyOf2, l1Var.a, l1Var2.a); return new l1(i, copyOf, copyOf2, true); } public final boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || !(obj instanceof l1)) { return false; } l1 l1Var = (l1) obj; int i = this.a; if (i == l1Var.a) { int[] iArr = this.b; int[] iArr2 = l1Var.b; int i2 = 0; while (true) { if (i2 >= i) { Object[] objArr = this.c; Object[] objArr2 = l1Var.c; int i3 = this.a; for (int i4 = 0; i4 < i3; i4++) { if (objArr[i4].equals(objArr2[i4])) { } } return true; } if (iArr[i2] != iArr2[i2]) { break; } i2++; } } return false; } public l1(int i, int[] iArr, Object[] objArr, boolean z) { this.d = -1; this.a = i; this.b = iArr; this.c = objArr; this.e = z; } public final int hashCode() { int i = this.a; int i2 = (i + IronSourceError.ERROR_NON_EXISTENT_INSTANCE) * 31; int[] iArr = this.b; int i3 = 17; int i4 = 17; for (int i5 = 0; i5 < i; i5++) { i4 = (i4 * 31) + iArr[i5]; } int i6 = (i2 + i4) * 31; Object[] objArr = this.c; int i7 = this.a; for (int i8 = 0; i8 < i7; i8++) { i3 = (i3 * 31) + objArr[i8].hashCode(); } return i6 + i3; } public final boolean a(int i, j jVar) throws IOException { int t; if (this.e) { int i2 = r1.a; int i3 = i >>> 3; int i4 = i & 7; if (i4 == 0) { a(i, Long.valueOf(jVar.l())); return true; } if (i4 == 1) { a(i, Long.valueOf(jVar.i())); return true; } if (i4 == 2) { a(i, jVar.e()); return true; } if (i4 != 3) { if (i4 == 4) { return false; } if (i4 == 5) { a(i, Integer.valueOf(jVar.h())); return true; } int i5 = z.a; throw new z.a(); } l1 l1Var = new l1(); do { t = jVar.t(); if (t == 0) { break; } } while (l1Var.a(t, jVar)); jVar.a(r1.a(i3, 4)); a(i, l1Var); return true; } throw new UnsupportedOperationException(); } public final void a(int i, Object obj) { if (this.e) { int i2 = this.a; int[] iArr = this.b; if (i2 == iArr.length) { int i3 = i2 + (i2 < 4 ? 8 : i2 >> 1); this.b = Arrays.copyOf(iArr, i3); this.c = Arrays.copyOf(this.c, i3); } int[] iArr2 = this.b; int i4 = this.a; iArr2[i4] = i; this.c[i4] = obj; this.a = i4 + 1; return; } throw new UnsupportedOperationException(); } public final void a(m mVar) throws IOException { if (this.a == 0) { return; } mVar.getClass(); for (int i = 0; i < this.a; i++) { int i2 = this.b[i]; Object obj = this.c[i]; int i3 = r1.a; int i4 = i2 >>> 3; int i5 = i2 & 7; if (i5 == 0) { mVar.a.b(i4, ((Long) obj).longValue()); } else if (i5 == 1) { mVar.a.a(i4, ((Long) obj).longValue()); } else if (i5 == 2) { mVar.a.b(i4, (i) obj); } else if (i5 == 3) { mVar.a.d(i4, 3); ((l1) obj).a(mVar); mVar.a.d(i4, 4); } else if (i5 == 5) { mVar.a.b(i4, ((Integer) obj).intValue()); } else { int i6 = z.a; throw new RuntimeException(new z.a()); } } } public final int a() { int d; int a; int b; int i = this.d; if (i != -1) { return i; } int i2 = 0; for (int i3 = 0; i3 < this.a; i3++) { int i4 = this.b[i3]; int i5 = r1.a; int i6 = i4 >>> 3; int i7 = i4 & 7; if (i7 != 0) { if (i7 == 1) { ((Long) this.c[i3]).longValue(); b = l.b(i6); } else if (i7 == 2) { b = l.a(i6, (i) this.c[i3]); } else if (i7 == 3) { d = l.d(i6) * 2; a = ((l1) this.c[i3]).a(); } else if (i7 == 5) { ((Integer) this.c[i3]).intValue(); b = l.a(i6); } else { int i8 = z.a; throw new IllegalStateException(new z.a()); } i2 = b + i2; } else { long longValue = ((Long) this.c[i3]).longValue(); d = l.d(i6); a = l.a(longValue); } i2 = a + d + i2; } this.d = i2; return i2; } }