package com.google.android.gms.internal.ads;

import java.util.Objects;

/* JADX INFO: loaded from: classes2.dex */
public final class vp2 implements kq2 {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final int f17746a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final /* synthetic */ yp2 f17747b;

    public vp2(yp2 yp2Var, int i10) {
        Objects.requireNonNull(yp2Var);
        this.f17747b = yp2Var;
        this.f17746a = i10;
    }

    /* JADX WARN: Removed duplicated region for block: B:35:0x0059  */
    @Override // com.google.android.gms.internal.ads.kq2
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final int a(long j10) {
        int iH;
        boolean z10;
        yp2 yp2Var = this.f17747b;
        int i10 = this.f17746a;
        if (yp2Var.t()) {
            return 0;
        }
        yp2Var.r(i10);
        jq2 jq2Var = yp2Var.T[i10];
        boolean z11 = yp2Var.f18957n0;
        synchronized (jq2Var) {
            int i11 = jq2Var.f12984n;
            int iJ = jq2Var.j(i11);
            int i12 = jq2Var.f12984n;
            int i13 = jq2Var.f12981k;
            if (i12 != i13 && j10 >= jq2Var.f12979i[iJ]) {
                if (j10 <= jq2Var.f12987q || !z11) {
                    iH = jq2Var.h(iJ, i13 - i11, j10, true);
                    if (iH == -1) {
                    }
                } else {
                    iH = i13 - i11;
                }
            }
            iH = 0;
        }
        synchronized (jq2Var) {
            if (iH >= 0) {
                try {
                    z10 = jq2Var.f12984n + iH <= jq2Var.f12981k;
                } catch (Throwable th) {
                    throw th;
                }
            }
            ih1.x(z10);
            jq2Var.f12984n += iH;
        }
        if (iH != 0) {
            return iH;
        }
        yp2Var.s(i10);
        return 0;
    }

    @Override // com.google.android.gms.internal.ads.kq2
    public final int b(di2 di2Var, fe2 fe2Var, int i10) {
        yp2 yp2Var = this.f17747b;
        if (yp2Var.t()) {
            return -3;
        }
        int i11 = this.f17746a;
        yp2Var.r(i11);
        int iN = yp2Var.T[i11].n(di2Var, fe2Var, i10, yp2Var.f18957n0);
        if (iN == -3) {
            yp2Var.s(i11);
        }
        return iN;
    }

    @Override // com.google.android.gms.internal.ads.kq2
    public final boolean zzb() {
        yp2 yp2Var = this.f17747b;
        return !yp2Var.t() && yp2Var.T[this.f17746a].m(yp2Var.f18957n0);
    }

    @Override // com.google.android.gms.internal.ads.kq2
    public final void zzc() throws zztg {
        yp2 yp2Var = this.f17747b;
        yp2Var.T[this.f17746a].l();
        yp2Var.f18949j.f(yp2Var.f18938d0 == 7 ? 6 : 3);
    }
}
