package com.google.android.gms.internal.measurement; import java.io.IOException; import java.util.List; /* loaded from: classes.dex */ final class zztt implements zzwk { private final zztq a; private int b; private int c; private int d = 0; private zztt(zztq zztqVar) { zzuq.a(zztqVar, "input"); this.a = zztqVar; this.a.c = this; } public static zztt a(zztq zztqVar) { zztt zzttVar = zztqVar.c; return zzttVar != null ? zzttVar : new zztt(zztqVar); } private final T d(zzwl zzwlVar, zzub zzubVar) throws IOException { int i = this.c; this.c = ((this.b >>> 3) << 3) | 4; try { T newInstance = zzwlVar.newInstance(); zzwlVar.a(newInstance, this, zzubVar); zzwlVar.c(newInstance); if (this.b == this.c) { return newInstance; } throw zzuv.zzww(); } finally { this.c = i; } } @Override // com.google.android.gms.internal.measurement.zzwk public final T b(zzwl zzwlVar, zzub zzubVar) throws IOException { a(2); return (T) c(zzwlVar, zzubVar); } @Override // com.google.android.gms.internal.measurement.zzwk public final long c() throws IOException { a(0); return this.a.e(); } @Override // com.google.android.gms.internal.measurement.zzwk public final String e() throws IOException { a(2); return this.a.k(); } @Override // com.google.android.gms.internal.measurement.zzwk public final boolean f() throws IOException { a(0); return this.a.j(); } @Override // com.google.android.gms.internal.measurement.zzwk public final int g() throws IOException { a(0); return this.a.q(); } @Override // com.google.android.gms.internal.measurement.zzwk public final int h() throws IOException { a(5); return this.a.i(); } @Override // com.google.android.gms.internal.measurement.zzwk public final long i() throws IOException { a(0); return this.a.r(); } @Override // com.google.android.gms.internal.measurement.zzwk public final int j() throws IOException { int i = this.d; if (i != 0) { this.b = i; this.d = 0; } else { this.b = this.a.d(); } int i2 = this.b; if (i2 == 0 || i2 == this.c) { return Integer.MAX_VALUE; } return i2 >>> 3; } @Override // com.google.android.gms.internal.measurement.zzwk public final long k() throws IOException { a(1); return this.a.p(); } @Override // com.google.android.gms.internal.measurement.zzwk public final String l() throws IOException { a(2); return this.a.c(); } @Override // com.google.android.gms.internal.measurement.zzwk public final long m() throws IOException { a(1); return this.a.h(); } @Override // com.google.android.gms.internal.measurement.zzwk public final boolean n() throws IOException { int i; if (this.a.s() || (i = this.b) == this.c) { return false; } return this.a.b(i); } @Override // com.google.android.gms.internal.measurement.zzwk public final int o() throws IOException { a(5); return this.a.o(); } @Override // com.google.android.gms.internal.measurement.zzwk public final int p() throws IOException { a(0); return this.a.g(); } @Override // com.google.android.gms.internal.measurement.zzwk public final int q() throws IOException { a(0); return this.a.n(); } @Override // com.google.android.gms.internal.measurement.zzwk public final long r() throws IOException { a(0); return this.a.f(); } @Override // com.google.android.gms.internal.measurement.zzwk public final double readDouble() throws IOException { a(1); return this.a.a(); } @Override // com.google.android.gms.internal.measurement.zzwk public final float readFloat() throws IOException { a(5); return this.a.b(); } private final T c(zzwl zzwlVar, zzub zzubVar) throws IOException { int m = this.a.m(); zztq zztqVar = this.a; if (zztqVar.a < zztqVar.b) { int d = zztqVar.d(m); T newInstance = zzwlVar.newInstance(); this.a.a++; zzwlVar.a(newInstance, this, zzubVar); zzwlVar.c(newInstance); this.a.a(0); r5.a--; this.a.e(d); return newInstance; } throw zzuv.zzwv(); } @Override // com.google.android.gms.internal.measurement.zzwk public final int a() { return this.b; } @Override // com.google.android.gms.internal.measurement.zzwk public final int b() throws IOException { a(0); return this.a.m(); } @Override // com.google.android.gms.internal.measurement.zzwk public final void e(List list) throws IOException { int d; int d2; if (list instanceof zzul) { zzul zzulVar = (zzul) list; int i = this.b & 7; if (i == 2) { int m = this.a.m(); c(m); int t = this.a.t() + m; do { zzulVar.a(this.a.b()); } while (this.a.t() < t); return; } if (i == 5) { do { zzulVar.a(this.a.b()); if (this.a.s()) { return; } else { d2 = this.a.d(); } } while (d2 == this.b); this.d = d2; return; } throw zzuv.zzwu(); } int i2 = this.b & 7; if (i2 == 2) { int m2 = this.a.m(); c(m2); int t2 = this.a.t() + m2; do { list.add(Float.valueOf(this.a.b())); } while (this.a.t() < t2); return; } if (i2 == 5) { do { list.add(Float.valueOf(this.a.b())); if (this.a.s()) { return; } else { d = this.a.d(); } } while (d == this.b); this.d = d; return; } throw zzuv.zzwu(); } @Override // com.google.android.gms.internal.measurement.zzwk public final void f(List list) throws IOException { int d; if ((this.b & 7) == 2) { do { list.add(d()); if (this.a.s()) { return; } else { d = this.a.d(); } } while (d == this.b); this.d = d; return; } throw zzuv.zzwu(); } @Override // com.google.android.gms.internal.measurement.zzwk public final void g(List list) throws IOException { int d; int d2; if (list instanceof zzty) { zzty zztyVar = (zzty) list; int i = this.b & 7; if (i == 1) { do { zztyVar.a(this.a.a()); if (this.a.s()) { return; } else { d2 = this.a.d(); } } while (d2 == this.b); this.d = d2; return; } if (i == 2) { int m = this.a.m(); b(m); int t = this.a.t() + m; do { zztyVar.a(this.a.a()); } while (this.a.t() < t); return; } throw zzuv.zzwu(); } int i2 = this.b & 7; if (i2 == 1) { do { list.add(Double.valueOf(this.a.a())); if (this.a.s()) { return; } else { d = this.a.d(); } } while (d == this.b); this.d = d; return; } if (i2 == 2) { int m2 = this.a.m(); b(m2); int t2 = this.a.t() + m2; do { list.add(Double.valueOf(this.a.a())); } while (this.a.t() < t2); return; } throw zzuv.zzwu(); } @Override // com.google.android.gms.internal.measurement.zzwk public final void h(List list) throws IOException { a(list, true); } @Override // com.google.android.gms.internal.measurement.zzwk public final void i(List list) throws IOException { int d; int d2; if (list instanceof zzvj) { zzvj zzvjVar = (zzvj) list; int i = this.b & 7; if (i == 0) { do { zzvjVar.a(this.a.f()); if (this.a.s()) { return; } else { d2 = this.a.d(); } } while (d2 == this.b); this.d = d2; return; } if (i == 2) { int t = this.a.t() + this.a.m(); do { zzvjVar.a(this.a.f()); } while (this.a.t() < t); d(t); return; } throw zzuv.zzwu(); } int i2 = this.b & 7; if (i2 == 0) { do { list.add(Long.valueOf(this.a.f())); if (this.a.s()) { return; } else { d = this.a.d(); } } while (d == this.b); this.d = d; return; } if (i2 == 2) { int t2 = this.a.t() + this.a.m(); do { list.add(Long.valueOf(this.a.f())); } while (this.a.t() < t2); d(t2); return; } throw zzuv.zzwu(); } @Override // com.google.android.gms.internal.measurement.zzwk public final void k(List list) throws IOException { int d; int d2; if (list instanceof zzvj) { zzvj zzvjVar = (zzvj) list; int i = this.b & 7; if (i == 0) { do { zzvjVar.a(this.a.e()); if (this.a.s()) { return; } else { d2 = this.a.d(); } } while (d2 == this.b); this.d = d2; return; } if (i == 2) { int t = this.a.t() + this.a.m(); do { zzvjVar.a(this.a.e()); } while (this.a.t() < t); d(t); return; } throw zzuv.zzwu(); } int i2 = this.b & 7; if (i2 == 0) { do { list.add(Long.valueOf(this.a.e())); if (this.a.s()) { return; } else { d = this.a.d(); } } while (d == this.b); this.d = d; return; } if (i2 == 2) { int t2 = this.a.t() + this.a.m(); do { list.add(Long.valueOf(this.a.e())); } while (this.a.t() < t2); d(t2); return; } throw zzuv.zzwu(); } @Override // com.google.android.gms.internal.measurement.zzwk public final void l(List list) throws IOException { int d; int d2; if (list instanceof zzup) { zzup zzupVar = (zzup) list; int i = this.b & 7; if (i == 0) { do { zzupVar.d(this.a.m()); if (this.a.s()) { return; } else { d2 = this.a.d(); } } while (d2 == this.b); this.d = d2; return; } if (i == 2) { int t = this.a.t() + this.a.m(); do { zzupVar.d(this.a.m()); } while (this.a.t() < t); d(t); return; } throw zzuv.zzwu(); } int i2 = this.b & 7; if (i2 == 0) { do { list.add(Integer.valueOf(this.a.m())); if (this.a.s()) { return; } else { d = this.a.d(); } } while (d == this.b); this.d = d; return; } if (i2 == 2) { int t2 = this.a.t() + this.a.m(); do { list.add(Integer.valueOf(this.a.m())); } while (this.a.t() < t2); d(t2); return; } throw zzuv.zzwu(); } @Override // com.google.android.gms.internal.measurement.zzwk public final void m(List list) throws IOException { a(list, false); } @Override // com.google.android.gms.internal.measurement.zzwk public final void n(List list) throws IOException { int d; int d2; if (list instanceof zzvj) { zzvj zzvjVar = (zzvj) list; int i = this.b & 7; if (i == 1) { do { zzvjVar.a(this.a.h()); if (this.a.s()) { return; } else { d2 = this.a.d(); } } while (d2 == this.b); this.d = d2; return; } if (i == 2) { int m = this.a.m(); b(m); int t = this.a.t() + m; do { zzvjVar.a(this.a.h()); } while (this.a.t() < t); return; } throw zzuv.zzwu(); } int i2 = this.b & 7; if (i2 == 1) { do { list.add(Long.valueOf(this.a.h())); if (this.a.s()) { return; } else { d = this.a.d(); } } while (d == this.b); this.d = d; return; } if (i2 == 2) { int m2 = this.a.m(); b(m2); int t2 = this.a.t() + m2; do { list.add(Long.valueOf(this.a.h())); } while (this.a.t() < t2); return; } throw zzuv.zzwu(); } @Override // com.google.android.gms.internal.measurement.zzwk public final void o(List list) throws IOException { int d; int d2; if (list instanceof zzvj) { zzvj zzvjVar = (zzvj) list; int i = this.b & 7; if (i == 1) { do { zzvjVar.a(this.a.p()); if (this.a.s()) { return; } else { d2 = this.a.d(); } } while (d2 == this.b); this.d = d2; return; } if (i == 2) { int m = this.a.m(); b(m); int t = this.a.t() + m; do { zzvjVar.a(this.a.p()); } while (this.a.t() < t); return; } throw zzuv.zzwu(); } int i2 = this.b & 7; if (i2 == 1) { do { list.add(Long.valueOf(this.a.p())); if (this.a.s()) { return; } else { d = this.a.d(); } } while (d == this.b); this.d = d; return; } if (i2 == 2) { int m2 = this.a.m(); b(m2); int t2 = this.a.t() + m2; do { list.add(Long.valueOf(this.a.p())); } while (this.a.t() < t2); return; } throw zzuv.zzwu(); } @Override // com.google.android.gms.internal.measurement.zzwk public final void p(List list) throws IOException { int d; int d2; if (list instanceof zzup) { zzup zzupVar = (zzup) list; int i = this.b & 7; if (i == 0) { do { zzupVar.d(this.a.g()); if (this.a.s()) { return; } else { d2 = this.a.d(); } } while (d2 == this.b); this.d = d2; return; } if (i == 2) { int t = this.a.t() + this.a.m(); do { zzupVar.d(this.a.g()); } while (this.a.t() < t); d(t); return; } throw zzuv.zzwu(); } int i2 = this.b & 7; if (i2 == 0) { do { list.add(Integer.valueOf(this.a.g())); if (this.a.s()) { return; } else { d = this.a.d(); } } while (d == this.b); this.d = d; return; } if (i2 == 2) { int t2 = this.a.t() + this.a.m(); do { list.add(Integer.valueOf(this.a.g())); } while (this.a.t() < t2); d(t2); return; } throw zzuv.zzwu(); } @Override // com.google.android.gms.internal.measurement.zzwk public final void q(List list) throws IOException { int d; int d2; if (list instanceof zzup) { zzup zzupVar = (zzup) list; int i = this.b & 7; if (i == 2) { int m = this.a.m(); c(m); int t = this.a.t() + m; do { zzupVar.d(this.a.o()); } while (this.a.t() < t); return; } if (i == 5) { do { zzupVar.d(this.a.o()); if (this.a.s()) { return; } else { d2 = this.a.d(); } } while (d2 == this.b); this.d = d2; return; } throw zzuv.zzwu(); } int i2 = this.b & 7; if (i2 == 2) { int m2 = this.a.m(); c(m2); int t2 = this.a.t() + m2; do { list.add(Integer.valueOf(this.a.o())); } while (this.a.t() < t2); return; } if (i2 == 5) { do { list.add(Integer.valueOf(this.a.o())); if (this.a.s()) { return; } else { d = this.a.d(); } } while (d == this.b); this.d = d; return; } throw zzuv.zzwu(); } private final void a(int i) throws IOException { if ((this.b & 7) != i) { throw zzuv.zzwu(); } } @Override // com.google.android.gms.internal.measurement.zzwk public final void b(List list) throws IOException { int d; int d2; if (list instanceof zzup) { zzup zzupVar = (zzup) list; int i = this.b & 7; if (i == 2) { int m = this.a.m(); c(m); int t = this.a.t() + m; do { zzupVar.d(this.a.i()); } while (this.a.t() < t); return; } if (i == 5) { do { zzupVar.d(this.a.i()); if (this.a.s()) { return; } else { d2 = this.a.d(); } } while (d2 == this.b); this.d = d2; return; } throw zzuv.zzwu(); } int i2 = this.b & 7; if (i2 == 2) { int m2 = this.a.m(); c(m2); int t2 = this.a.t() + m2; do { list.add(Integer.valueOf(this.a.i())); } while (this.a.t() < t2); return; } if (i2 == 5) { do { list.add(Integer.valueOf(this.a.i())); if (this.a.s()) { return; } else { d = this.a.d(); } } while (d == this.b); this.d = d; return; } throw zzuv.zzwu(); } @Override // com.google.android.gms.internal.measurement.zzwk public final T a(zzwl zzwlVar, zzub zzubVar) throws IOException { a(3); return (T) d(zzwlVar, zzubVar); } @Override // com.google.android.gms.internal.measurement.zzwk public final void j(List list) throws IOException { int d; int d2; if (list instanceof zzup) { zzup zzupVar = (zzup) list; int i = this.b & 7; if (i == 0) { do { zzupVar.d(this.a.n()); if (this.a.s()) { return; } else { d2 = this.a.d(); } } while (d2 == this.b); this.d = d2; return; } if (i == 2) { int t = this.a.t() + this.a.m(); do { zzupVar.d(this.a.n()); } while (this.a.t() < t); d(t); return; } throw zzuv.zzwu(); } int i2 = this.b & 7; if (i2 == 0) { do { list.add(Integer.valueOf(this.a.n())); if (this.a.s()) { return; } else { d = this.a.d(); } } while (d == this.b); this.d = d; return; } if (i2 == 2) { int t2 = this.a.t() + this.a.m(); do { list.add(Integer.valueOf(this.a.n())); } while (this.a.t() < t2); d(t2); return; } throw zzuv.zzwu(); } @Override // com.google.android.gms.internal.measurement.zzwk public final void a(List list) throws IOException { int d; int d2; if (list instanceof zztc) { zztc zztcVar = (zztc) list; int i = this.b & 7; if (i == 0) { do { zztcVar.a(this.a.j()); if (this.a.s()) { return; } else { d2 = this.a.d(); } } while (d2 == this.b); this.d = d2; return; } if (i == 2) { int t = this.a.t() + this.a.m(); do { zztcVar.a(this.a.j()); } while (this.a.t() < t); d(t); return; } throw zzuv.zzwu(); } int i2 = this.b & 7; if (i2 == 0) { do { list.add(Boolean.valueOf(this.a.j())); if (this.a.s()) { return; } else { d = this.a.d(); } } while (d == this.b); this.d = d; return; } if (i2 == 2) { int t2 = this.a.t() + this.a.m(); do { list.add(Boolean.valueOf(this.a.j())); } while (this.a.t() < t2); d(t2); return; } throw zzuv.zzwu(); } @Override // com.google.android.gms.internal.measurement.zzwk public final zzte d() throws IOException { a(2); return this.a.l(); } @Override // com.google.android.gms.internal.measurement.zzwk public final void d(List list) throws IOException { int d; int d2; if (list instanceof zzup) { zzup zzupVar = (zzup) list; int i = this.b & 7; if (i == 0) { do { zzupVar.d(this.a.q()); if (this.a.s()) { return; } else { d2 = this.a.d(); } } while (d2 == this.b); this.d = d2; return; } if (i == 2) { int t = this.a.t() + this.a.m(); do { zzupVar.d(this.a.q()); } while (this.a.t() < t); d(t); return; } throw zzuv.zzwu(); } int i2 = this.b & 7; if (i2 == 0) { do { list.add(Integer.valueOf(this.a.q())); if (this.a.s()) { return; } else { d = this.a.d(); } } while (d == this.b); this.d = d; return; } if (i2 == 2) { int t2 = this.a.t() + this.a.m(); do { list.add(Integer.valueOf(this.a.q())); } while (this.a.t() < t2); d(t2); return; } throw zzuv.zzwu(); } @Override // com.google.android.gms.internal.measurement.zzwk public final void c(List list) throws IOException { int d; int d2; if (list instanceof zzvj) { zzvj zzvjVar = (zzvj) list; int i = this.b & 7; if (i == 0) { do { zzvjVar.a(this.a.r()); if (this.a.s()) { return; } else { d2 = this.a.d(); } } while (d2 == this.b); this.d = d2; return; } if (i == 2) { int t = this.a.t() + this.a.m(); do { zzvjVar.a(this.a.r()); } while (this.a.t() < t); d(t); return; } throw zzuv.zzwu(); } int i2 = this.b & 7; if (i2 == 0) { do { list.add(Long.valueOf(this.a.r())); if (this.a.s()) { return; } else { d = this.a.d(); } } while (d == this.b); this.d = d; return; } if (i2 == 2) { int t2 = this.a.t() + this.a.m(); do { list.add(Long.valueOf(this.a.r())); } while (this.a.t() < t2); d(t2); return; } throw zzuv.zzwu(); } /* JADX WARN: Multi-variable type inference failed */ @Override // com.google.android.gms.internal.measurement.zzwk public final void b(List list, zzwl zzwlVar, zzub zzubVar) throws IOException { int d; int i = this.b; if ((i & 7) == 2) { do { list.add(c(zzwlVar, zzubVar)); if (this.a.s() || this.d != 0) { return; } else { d = this.a.d(); } } while (d == i); this.d = d; return; } throw zzuv.zzwu(); } private final void a(List list, boolean z) throws IOException { int d; int d2; if ((this.b & 7) == 2) { if ((list instanceof zzve) && !z) { zzve zzveVar = (zzve) list; do { zzveVar.a(d()); if (this.a.s()) { return; } else { d2 = this.a.d(); } } while (d2 == this.b); this.d = d2; return; } do { list.add(z ? e() : l()); if (this.a.s()) { return; } else { d = this.a.d(); } } while (d == this.b); this.d = d; return; } throw zzuv.zzwu(); } private static void b(int i) throws IOException { if ((i & 7) != 0) { throw zzuv.zzww(); } } private final void d(int i) throws IOException { if (this.a.t() != i) { throw zzuv.zzwq(); } } private static void c(int i) throws IOException { if ((i & 3) != 0) { throw zzuv.zzww(); } } /* JADX WARN: Multi-variable type inference failed */ @Override // com.google.android.gms.internal.measurement.zzwk public final void a(List list, zzwl zzwlVar, zzub zzubVar) throws IOException { int d; int i = this.b; if ((i & 7) == 3) { do { list.add(d(zzwlVar, zzubVar)); if (this.a.s() || this.d != 0) { return; } else { d = this.a.d(); } } while (d == i); this.d = d; return; } throw zzuv.zzwu(); } }