package com.applovin.impl; import com.applovin.impl.ij; import com.mbridge.msdk.playercommon.exoplayer2.C; /* loaded from: classes.dex */ public final class e9 implements k8 { public static final o8 q = new o8() { // from class: com.applovin.impl.e9$$ExternalSyntheticLambda0 @Override // com.applovin.impl.o8 public final k8[] a() { k8[] d; d = e9.d(); return d; } }; private m8 f; private boolean h; private long i; private int j; private int k; private int l; private long m; private boolean n; private s1 o; private yq p; private final bh a = new bh(4); private final bh b = new bh(9); private final bh c = new bh(11); private final bh d = new bh(); private final ej e = new ej(); private int g = 1; @Override // com.applovin.impl.k8 public void a() { } @Override // com.applovin.impl.k8 public void a(long j, long j2) { if (j == 0) { this.g = 1; this.h = false; } else { this.g = 3; } this.j = 0; } @Override // com.applovin.impl.k8 public void a(m8 m8Var) { this.f = m8Var; } private void f(l8 l8Var) { l8Var.a(this.j); this.j = 0; this.g = 3; } private boolean e(l8 l8Var) { if (!l8Var.a(this.c.c(), 0, 11, true)) { return false; } this.c.f(0); this.k = this.c.w(); this.l = this.c.z(); this.m = this.c.z(); this.m = ((this.c.w() << 24) | this.m) * 1000; this.c.g(3); this.g = 4; return true; } /* JADX WARN: Removed duplicated region for block: B:12:0x0087 */ /* JADX WARN: Removed duplicated region for block: B:14:0x008b */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ private boolean d(com.applovin.impl.l8 r10) { /* r9 = this; long r0 = r9.c() int r2 = r9.k r3 = 8 r4 = -9223372036854775807(0x8000000000000001, double:-4.9E-324) r6 = 1 if (r2 != r3) goto L23 com.applovin.impl.s1 r3 = r9.o if (r3 == 0) goto L23 r9.b() com.applovin.impl.s1 r2 = r9.o com.applovin.impl.bh r10 = r9.b(r10) boolean r10 = r2.a(r10, r0) L21: r0 = r6 goto L75 L23: r3 = 9 if (r2 != r3) goto L39 com.applovin.impl.yq r3 = r9.p if (r3 == 0) goto L39 r9.b() com.applovin.impl.yq r2 = r9.p com.applovin.impl.bh r10 = r9.b(r10) boolean r10 = r2.a(r10, r0) goto L21 L39: r3 = 18 if (r2 != r3) goto L6e boolean r2 = r9.n if (r2 != 0) goto L6e com.applovin.impl.ej r2 = r9.e com.applovin.impl.bh r10 = r9.b(r10) boolean r10 = r2.a(r10, r0) com.applovin.impl.ej r0 = r9.e long r0 = r0.a() int r2 = (r0 > r4 ? 1 : (r0 == r4 ? 0 : -1)) if (r2 == 0) goto L21 com.applovin.impl.m8 r2 = r9.f com.applovin.impl.mb r3 = new com.applovin.impl.mb com.applovin.impl.ej r7 = r9.e long[] r7 = r7.b() com.applovin.impl.ej r8 = r9.e long[] r8 = r8.c() r3.(r7, r8, r0) r2.a(r3) r9.n = r6 goto L21 L6e: int r0 = r9.l r10.a(r0) r10 = 0 r0 = r10 L75: boolean r1 = r9.h if (r1 != 0) goto L8f if (r10 == 0) goto L8f r9.h = r6 com.applovin.impl.ej r10 = r9.e long r1 = r10.a() int r10 = (r1 > r4 ? 1 : (r1 == r4 ? 0 : -1)) if (r10 != 0) goto L8b long r1 = r9.m long r1 = -r1 goto L8d L8b: r1 = 0 L8d: r9.i = r1 L8f: r10 = 4 r9.j = r10 r10 = 2 r9.g = r10 return r0 */ throw new UnsupportedOperationException("Method not decompiled: com.applovin.impl.e9.d(com.applovin.impl.l8):boolean"); } @Override // com.applovin.impl.k8 public int a(l8 l8Var, th thVar) { b1.b(this.f); while (true) { int i = this.g; if (i != 1) { if (i == 2) { f(l8Var); } else if (i != 3) { if (i != 4) { throw new IllegalStateException(); } if (d(l8Var)) { return 0; } } else if (!e(l8Var)) { return -1; } } else if (!c(l8Var)) { return -1; } } } /* JADX INFO: Access modifiers changed from: private */ public static /* synthetic */ k8[] d() { return new k8[]{new e9()}; } private void b() { if (this.n) { return; } this.f.a(new ij.b(C.TIME_UNSET)); this.n = true; } private long c() { if (this.h) { return this.i + this.m; } if (this.e.a() == C.TIME_UNSET) { return 0L; } return this.m; } private boolean c(l8 l8Var) { if (!l8Var.a(this.b.c(), 0, 9, true)) { return false; } this.b.f(0); this.b.g(4); int w = this.b.w(); boolean z = (w & 4) != 0; boolean z2 = (w & 1) != 0; if (z && this.o == null) { this.o = new s1(this.f.a(8, 1)); } if (z2 && this.p == null) { this.p = new yq(this.f.a(9, 2)); } this.f.c(); this.j = this.b.j() - 5; this.g = 2; return true; } @Override // com.applovin.impl.k8 public boolean a(l8 l8Var) { l8Var.c(this.a.c(), 0, 3); this.a.f(0); if (this.a.z() != 4607062) { return false; } l8Var.c(this.a.c(), 0, 2); this.a.f(0); if ((this.a.C() & 250) != 0) { return false; } l8Var.c(this.a.c(), 0, 4); this.a.f(0); int j = this.a.j(); l8Var.b(); l8Var.c(j); l8Var.c(this.a.c(), 0, 4); this.a.f(0); return this.a.j() == 0; } private bh b(l8 l8Var) { if (this.l > this.d.b()) { bh bhVar = this.d; bhVar.a(new byte[Math.max(bhVar.b() * 2, this.l)], 0); } else { this.d.f(0); } this.d.e(this.l); l8Var.d(this.d.c(), 0, this.l); return this.d; } }