package h;

import com.cvte.vman.instance.InvokeCmd;
import javax.annotation.Nullable;

/* JADX INFO: loaded from: classes.dex */
public final class t {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final byte[] f6560a;

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

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

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

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

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public t f6565f;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public t f6566g;

    public t() {
        this.f6560a = new byte[InvokeCmd.CMD_TOUCH_CTRL_START];
        this.f6564e = true;
        this.f6563d = false;
    }

    public t(byte[] bArr, int i2, int i3, boolean z, boolean z2) {
        this.f6560a = bArr;
        this.f6561b = i2;
        this.f6562c = i3;
        this.f6563d = z;
        this.f6564e = z2;
    }

    @Nullable
    public final t a() {
        t tVar = this.f6565f;
        t tVar2 = tVar != this ? tVar : null;
        t tVar3 = this.f6566g;
        tVar3.f6565f = tVar;
        this.f6565f.f6566g = tVar3;
        this.f6565f = null;
        this.f6566g = null;
        return tVar2;
    }

    public final t b(t tVar) {
        tVar.f6566g = this;
        tVar.f6565f = this.f6565f;
        this.f6565f.f6566g = tVar;
        this.f6565f = tVar;
        return tVar;
    }

    public final t c() {
        this.f6563d = true;
        return new t(this.f6560a, this.f6561b, this.f6562c, true, false);
    }

    public final void d(t tVar, int i2) {
        if (!tVar.f6564e) {
            throw new IllegalArgumentException();
        }
        int i3 = tVar.f6562c;
        if (i3 + i2 > 8192) {
            if (tVar.f6563d) {
                throw new IllegalArgumentException();
            }
            int i4 = tVar.f6561b;
            if ((i3 + i2) - i4 > 8192) {
                throw new IllegalArgumentException();
            }
            byte[] bArr = tVar.f6560a;
            System.arraycopy(bArr, i4, bArr, 0, i3 - i4);
            tVar.f6562c -= tVar.f6561b;
            tVar.f6561b = 0;
        }
        System.arraycopy(this.f6560a, this.f6561b, tVar.f6560a, tVar.f6562c, i2);
        tVar.f6562c += i2;
        this.f6561b += i2;
    }
}
