package p138.p176.p177.p190.p217;

import java.nio.ByteBuffer;
import p138.p176.p177.p190.p238.C4088;
import p138.p176.p177.p190.p238.C4099;
import p138.p176.p177.p190.p238.InterfaceC4089;
import p138.p176.p177.p190.p239.C4140;

/* JADX INFO: renamed from: ދ.ހ.֏.ؠ.ໞ.ޕ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public class C3818 {

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final InterfaceC4089 f11724;

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public final int f11725;

    /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
    public final C4140 f11726 = new C4140(32);

    /* JADX INFO: renamed from: ށ, reason: contains not printable characters */
    public C3819 f11727;

    /* JADX INFO: renamed from: ނ, reason: contains not printable characters */
    public C3819 f11728;

    /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
    public C3819 f11729;

    /* JADX INFO: renamed from: ބ, reason: contains not printable characters */
    public long f11730;

    /* JADX INFO: renamed from: ދ.ހ.֏.ؠ.ໞ.ޕ$֏, reason: contains not printable characters */
    public static final class C3819 {

        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public final long f11731;

        /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
        public final long f11732;

        /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
        public boolean f11733;

        /* JADX INFO: renamed from: ށ, reason: contains not printable characters */
        public C4088 f11734;

        /* JADX INFO: renamed from: ނ, reason: contains not printable characters */
        public C3819 f11735;

        public C3819(long j, int i) {
            this.f11731 = j;
            this.f11732 = j + ((long) i);
        }

        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public int m6169(long j) {
            return ((int) (j - this.f11731)) + this.f11734.f13061;
        }
    }

    public C3818(InterfaceC4089 interfaceC4089) {
        this.f11724 = interfaceC4089;
        this.f11725 = ((C4099) interfaceC4089).f13086;
        C3819 c3819 = new C3819(0L, this.f11725);
        this.f11727 = c3819;
        this.f11728 = c3819;
        this.f11729 = c3819;
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final void m6163(int i) {
        long j = this.f11730 + ((long) i);
        this.f11730 = j;
        C3819 c3819 = this.f11729;
        if (j == c3819.f11732) {
            this.f11729 = c3819.f11735;
        }
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public void m6164(long j) {
        C3819 c3819;
        if (j == -1) {
            return;
        }
        while (true) {
            c3819 = this.f11727;
            if (j < c3819.f11732) {
                break;
            }
            ((C4099) this.f11724).m6588(c3819.f11734);
            C3819 c38192 = this.f11727;
            c38192.f11734 = null;
            C3819 c38193 = c38192.f11735;
            c38192.f11735 = null;
            this.f11727 = c38193;
        }
        if (this.f11728.f11731 < c3819.f11731) {
            this.f11728 = c3819;
        }
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final void m6165(long j, ByteBuffer byteBuffer, int i) {
        while (true) {
            C3819 c3819 = this.f11728;
            if (j < c3819.f11732) {
                break;
            } else {
                this.f11728 = c3819.f11735;
            }
        }
        while (i > 0) {
            int iMin = Math.min(i, (int) (this.f11728.f11732 - j));
            C3819 c38192 = this.f11728;
            byteBuffer.put(c38192.f11734.f13060, c38192.m6169(j), iMin);
            i -= iMin;
            j += (long) iMin;
            C3819 c38193 = this.f11728;
            if (j == c38193.f11732) {
                this.f11728 = c38193.f11735;
            }
        }
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final void m6166(long j, byte[] bArr, int i) {
        while (true) {
            C3819 c3819 = this.f11728;
            if (j < c3819.f11732) {
                break;
            } else {
                this.f11728 = c3819.f11735;
            }
        }
        int i2 = i;
        while (i2 > 0) {
            int iMin = Math.min(i2, (int) (this.f11728.f11732 - j));
            C3819 c38192 = this.f11728;
            System.arraycopy(c38192.f11734.f13060, c38192.m6169(j), bArr, i - i2, iMin);
            i2 -= iMin;
            j += (long) iMin;
            C3819 c38193 = this.f11728;
            if (j == c38193.f11732) {
                this.f11728 = c38193.f11735;
            }
        }
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final void m6167(C3819 c3819) {
        if (c3819.f11733) {
            C3819 c38192 = this.f11729;
            int i = (((int) (c38192.f11731 - c3819.f11731)) / this.f11725) + (c38192.f11733 ? 1 : 0);
            C4088[] c4088Arr = new C4088[i];
            int i2 = 0;
            while (i2 < i) {
                c4088Arr[i2] = c3819.f11734;
                c3819.f11734 = null;
                C3819 c38193 = c3819.f11735;
                c3819.f11735 = null;
                i2++;
                c3819 = c38193;
            }
            ((C4099) this.f11724).m6589(c4088Arr);
        }
    }

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public final int m6168(int i) {
        C3819 c3819 = this.f11729;
        if (!c3819.f11733) {
            C4088 c4088M6586 = ((C4099) this.f11724).m6586();
            C3819 c38192 = new C3819(this.f11729.f11732, this.f11725);
            c3819.f11734 = c4088M6586;
            c3819.f11735 = c38192;
            c3819.f11733 = true;
        }
        return Math.min(i, (int) (this.f11729.f11732 - this.f11730));
    }
}
