package p138.p176.p177.p190.p198.p201;

import java.io.EOFException;
import p138.p176.p177.p190.p198.C3558;
import p138.p176.p177.p190.p198.C3570;
import p138.p176.p177.p190.p198.InterfaceC3561;
import p138.p176.p177.p190.p198.InterfaceC3562;
import p138.p176.p177.p190.p198.InterfaceC3571;
import p138.p176.p177.p190.p239.C4140;

/* JADX INFO: renamed from: ދ.ހ.֏.ؠ.ೲ.ޗ.ؠ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public final class C3588 implements InterfaceC3561 {

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

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

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

    /* JADX INFO: renamed from: އ, reason: contains not printable characters */
    public int f10666;

    /* JADX INFO: renamed from: ވ, reason: contains not printable characters */
    public int f10667;

    /* JADX INFO: renamed from: މ, reason: contains not printable characters */
    public int f10668;

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

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

    /* JADX INFO: renamed from: ތ, reason: contains not printable characters */
    public C3587 f10671;

    /* JADX INFO: renamed from: ލ, reason: contains not printable characters */
    public C3590 f10672;

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final C4140 f10657 = new C4140(4);

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public final C4140 f10658 = new C4140(9);

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

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

    /* JADX INFO: renamed from: ނ, reason: contains not printable characters */
    public final C3589 f10661 = new C3589();

    /* JADX INFO: renamed from: ބ, reason: contains not printable characters */
    public int f10663 = 1;

    /* JADX WARN: Removed duplicated region for block: B:40:0x00a2  */
    /* JADX WARN: Removed duplicated region for block: B:79:0x00ad A[SYNTHETIC] */
    /* JADX WARN: Removed duplicated region for block: B:89:0x0004 A[SYNTHETIC] */
    @Override // p138.p176.p177.p190.p198.InterfaceC3561
    /* JADX INFO: renamed from: ֏ */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public int mo5886(C3558 c3558, C3570 c3570) throws InterruptedException, EOFException {
        boolean zM1141;
        boolean z;
        while (true) {
            int i = this.f10663;
            if (i == 1) {
                if (c3558.m5877(this.f10658.f13227, 0, 9, true)) {
                    this.f10658.m6693(0);
                    this.f10658.m6695(4);
                    int iM6702 = this.f10658.m6702();
                    boolean z2 = (iM6702 & 4) != 0;
                    z = (iM6702 & 1) != 0;
                    if (z2 && this.f10671 == null) {
                        this.f10671 = new C3587(this.f10662.mo5891(8, 1));
                    }
                    if (z && this.f10672 == null) {
                        this.f10672 = new C3590(this.f10662.mo5891(9, 2));
                    }
                    this.f10662.mo5892();
                    this.f10666 = (this.f10658.m6688() - 9) + 4;
                    this.f10663 = 2;
                    z = true;
                }
                if (!z) {
                    return -1;
                }
            } else if (i == 2) {
                c3558.m5878(this.f10666);
                this.f10666 = 0;
                this.f10663 = 3;
            } else if (i == 3) {
                if (c3558.m5877(this.f10659.f13227, 0, 11, true)) {
                    this.f10659.m6693(0);
                    this.f10667 = this.f10659.m6702();
                    this.f10668 = this.f10659.m6704();
                    this.f10669 = this.f10659.m6704();
                    this.f10669 = (((long) (this.f10659.m6702() << 24)) | this.f10669) * 1000;
                    this.f10659.m6695(3);
                    this.f10663 = 4;
                    z = true;
                }
                if (!z) {
                    return -1;
                }
            } else {
                if (i != 4) {
                    throw new IllegalStateException();
                }
                long j = this.f10664 ? this.f10665 + this.f10669 : this.f10661.f10673 == -9223372036854775807L ? 0L : this.f10669;
                if (this.f10667 == 8 && this.f10671 != null) {
                    m5913();
                    zM1141 = this.f10671.m1141(m5912(c3558), j);
                } else if (this.f10667 == 9 && this.f10672 != null) {
                    m5913();
                    zM1141 = this.f10672.m1141(m5912(c3558), j);
                } else if (this.f10667 != 18 || this.f10670) {
                    c3558.m5878(this.f10668);
                    zM1141 = false;
                    z = false;
                    if (!this.f10664 && zM1141) {
                        this.f10664 = true;
                        this.f10665 = this.f10661.f10673 == -9223372036854775807L ? -this.f10669 : 0L;
                    }
                    this.f10666 = 4;
                    this.f10663 = 2;
                    if (!z) {
                        return 0;
                    }
                } else {
                    zM1141 = this.f10661.m1141(m5912(c3558), j);
                    long j2 = this.f10661.f10673;
                    if (j2 != -9223372036854775807L) {
                        this.f10662.mo5893(new InterfaceC3571.C3573(j2, 0L));
                        this.f10670 = true;
                    }
                }
                z = true;
                if (!this.f10664) {
                    this.f10664 = true;
                    this.f10665 = this.f10661.f10673 == -9223372036854775807L ? -this.f10669 : 0L;
                }
                this.f10666 = 4;
                this.f10663 = 2;
                if (!z) {
                }
            }
        }
    }

    @Override // p138.p176.p177.p190.p198.InterfaceC3561
    /* JADX INFO: renamed from: ֏ */
    public void mo5887() {
    }

    @Override // p138.p176.p177.p190.p198.InterfaceC3561
    /* JADX INFO: renamed from: ֏ */
    public void mo5888(long j, long j2) {
        this.f10663 = 1;
        this.f10664 = false;
        this.f10666 = 0;
    }

    @Override // p138.p176.p177.p190.p198.InterfaceC3561
    /* JADX INFO: renamed from: ֏ */
    public void mo5889(InterfaceC3562 interfaceC3562) {
        this.f10662 = interfaceC3562;
    }

    @Override // p138.p176.p177.p190.p198.InterfaceC3561
    /* JADX INFO: renamed from: ֏ */
    public boolean mo5890(C3558 c3558) throws InterruptedException, EOFException {
        c3558.m5875(this.f10657.f13227, 0, 3, false);
        this.f10657.m6693(0);
        if (this.f10657.m6704() != 4607062) {
            return false;
        }
        c3558.m5875(this.f10657.f13227, 0, 2, false);
        this.f10657.m6693(0);
        if ((this.f10657.m6707() & 250) != 0) {
            return false;
        }
        c3558.m5875(this.f10657.f13227, 0, 4, false);
        this.f10657.m6693(0);
        int iM6688 = this.f10657.m6688();
        c3558.f10565 = 0;
        c3558.m5874(iM6688, false);
        c3558.m5875(this.f10657.f13227, 0, 4, false);
        this.f10657.m6693(0);
        return this.f10657.m6688() == 0;
    }

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public final C4140 m5912(C3558 c3558) throws InterruptedException, EOFException {
        int i = this.f10668;
        C4140 c4140 = this.f10660;
        byte[] bArr = c4140.f13227;
        if (i > bArr.length) {
            c4140.f13227 = new byte[Math.max(bArr.length * 2, i)];
            c4140.f13229 = 0;
            c4140.f13228 = 0;
        } else {
            c4140.m6693(0);
        }
        this.f10660.m6691(this.f10668);
        c3558.m5877(this.f10660.f13227, 0, this.f10668, false);
        return this.f10660;
    }

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public final void m5913() {
        if (this.f10670) {
            return;
        }
        this.f10662.mo5893(new InterfaceC3571.C3573(-9223372036854775807L, 0L));
        this.f10670 = true;
    }
}
