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

import java.util.Arrays;

/* JADX INFO: loaded from: classes2.dex */
public final class wa {

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

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public boolean f17967b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public boolean f17968c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public byte[] f17969d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public int f17970e;

    public wa(int i10) {
        this.f17966a = i10;
        byte[] bArr = new byte[131];
        this.f17969d = bArr;
        bArr[2] = 1;
    }

    public final void a() {
        this.f17967b = false;
        this.f17968c = false;
    }

    public final void b(int i10) {
        ih1.b1(!this.f17967b);
        boolean z10 = i10 == this.f17966a;
        this.f17967b = z10;
        if (z10) {
            this.f17970e = 3;
            this.f17968c = false;
        }
    }

    public final void c(int i10, int i11, byte[] bArr) {
        if (this.f17967b) {
            int i12 = i11 - i10;
            byte[] bArr2 = this.f17969d;
            int length = bArr2.length;
            int i13 = this.f17970e + i12;
            if (length < i13) {
                this.f17969d = Arrays.copyOf(bArr2, i13 + i13);
            }
            System.arraycopy(bArr, i10, this.f17969d, this.f17970e, i12);
            this.f17970e += i12;
        }
    }

    public final boolean d(int i10) {
        if (!this.f17967b) {
            return false;
        }
        this.f17970e -= i10;
        this.f17967b = false;
        this.f17968c = true;
        return true;
    }
}
