package p138.p176.p177.p190.p217;

import p000.p001.p002.p003.p004.C0567;
import p138.p176.p177.p190.C3431;
import p138.p176.p177.p190.C3433;
import p138.p176.p177.p190.C3453;
import p138.p176.p177.p190.p193.C3511;
import p138.p176.p177.p190.p217.InterfaceC3798;
import p138.p176.p177.p190.p235.InterfaceC4036;
import p138.p176.p177.p190.p239.C4134;
import p138.p176.p177.p190.p239.C4150;

/* JADX INFO: renamed from: ދ.ހ.֏.ؠ.ໞ.ފ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public final class C3791 implements InterfaceC3798, InterfaceC3798.InterfaceC3799 {

    /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
    public final InterfaceC3798 f11614;

    /* JADX INFO: renamed from: ބ, reason: contains not printable characters */
    public InterfaceC3798.InterfaceC3799 f11615;

    /* JADX INFO: renamed from: ޅ, reason: contains not printable characters */
    public C3792[] f11616 = new C3792[0];

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

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

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

    /* JADX INFO: renamed from: ދ.ހ.֏.ؠ.ໞ.ފ$֏, reason: contains not printable characters */
    public final class C3792 implements InterfaceC3823 {

        /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
        public final InterfaceC3823 f11620;

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

        public C3792(InterfaceC3823 interfaceC3823) {
            this.f11620 = interfaceC3823;
        }

        @Override // p138.p176.p177.p190.p217.InterfaceC3823
        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public int mo6116(C3433 c3433, C3511 c3511, boolean z) {
            if (C3791.this.m6106()) {
                return -3;
            }
            if (this.f11621) {
                c3511.f10443 = 4;
                return -4;
            }
            int iMo6116 = this.f11620.mo6116(c3433, c3511, z);
            if (iMo6116 == -5) {
                C3431 c3431 = c3433.f10114;
                C0567.m1856(c3431);
                C3431 c34312 = c3431;
                if (c34312.f10106 != 0 || c34312.f10107 != 0) {
                    c3433.f10114 = c34312.m5597(C3791.this.f11618 != 0 ? 0 : c34312.f10106, C3791.this.f11619 == Long.MIN_VALUE ? c34312.f10107 : 0);
                }
                return -5;
            }
            long j = C3791.this.f11619;
            if (j == Long.MIN_VALUE || ((iMo6116 != -4 || c3511.f10463 < j) && !(iMo6116 == -3 && C3791.this.mo6112() == Long.MIN_VALUE && !c3511.f10462))) {
                return iMo6116;
            }
            c3511.mo5803();
            c3511.f10443 = 4;
            this.f11621 = true;
            return -4;
        }

        @Override // p138.p176.p177.p190.p217.InterfaceC3823
        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public void mo6117() {
            this.f11620.mo6117();
        }

        @Override // p138.p176.p177.p190.p217.InterfaceC3823
        /* JADX INFO: renamed from: ށ, reason: contains not printable characters */
        public int mo6118(long j) {
            if (C3791.this.m6106()) {
                return -3;
            }
            return this.f11620.mo6118(j);
        }

        @Override // p138.p176.p177.p190.p217.InterfaceC3823
        /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
        public boolean mo6119() {
            return !C3791.this.m6106() && this.f11620.mo6119();
        }
    }

    public C3791(InterfaceC3798 interfaceC3798, boolean z, long j, long j2) {
        this.f11614 = interfaceC3798;
        this.f11617 = z ? j : -9223372036854775807L;
        this.f11618 = j;
        this.f11619 = j2;
    }

    @Override // p138.p176.p177.p190.p217.InterfaceC3798
    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public long mo6102(long j, C3453 c3453) {
        long j2 = this.f11618;
        if (j == j2) {
            return j2;
        }
        long jM6789 = C4150.m6789(c3453.f10183, 0L, j - j2);
        long j3 = c3453.f10184;
        long j4 = this.f11619;
        long jM67892 = C4150.m6789(j3, 0L, j4 == Long.MIN_VALUE ? Long.MAX_VALUE : j4 - j);
        if (jM6789 != c3453.f10183 || jM67892 != c3453.f10184) {
            c3453 = new C3453(jM6789, jM67892);
        }
        return this.f11614.mo6102(j, c3453);
    }

    /* JADX WARN: Removed duplicated region for block: B:25:0x0066  */
    /* JADX WARN: Removed duplicated region for block: B:26:0x0068  */
    /* JADX WARN: Removed duplicated region for block: B:36:0x0086  */
    @Override // p138.p176.p177.p190.p217.InterfaceC3798
    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public long mo6103(InterfaceC4036[] interfaceC4036Arr, boolean[] zArr, InterfaceC3823[] interfaceC3823Arr, boolean[] zArr2, long j) {
        long j2;
        boolean z;
        this.f11616 = new C3792[interfaceC3823Arr.length];
        InterfaceC3823[] interfaceC3823Arr2 = new InterfaceC3823[interfaceC3823Arr.length];
        int i = 0;
        while (true) {
            InterfaceC3823 interfaceC3823 = null;
            if (i >= interfaceC3823Arr.length) {
                break;
            }
            C3792[] c3792Arr = this.f11616;
            c3792Arr[i] = (C3792) interfaceC3823Arr[i];
            if (c3792Arr[i] != null) {
                interfaceC3823 = c3792Arr[i].f11620;
            }
            interfaceC3823Arr2[i] = interfaceC3823;
            i++;
        }
        long jMo6103 = this.f11614.mo6103(interfaceC4036Arr, zArr, interfaceC3823Arr2, zArr2, j);
        boolean z2 = true;
        if (m6106()) {
            long j3 = this.f11618;
            if (j != j3) {
                j2 = -9223372036854775807L;
            } else if (j3 != 0) {
                for (InterfaceC4036 interfaceC4036 : interfaceC4036Arr) {
                    if (interfaceC4036 != null && !C4134.m6657(interfaceC4036.mo6483().f10090)) {
                        z = true;
                        break;
                    }
                }
                z = false;
                if (!z) {
                    j2 = jMo6103;
                }
            } else {
                z = false;
                if (!z) {
                }
            }
        }
        this.f11617 = j2;
        if (jMo6103 != j) {
            if (jMo6103 >= this.f11618) {
                long j4 = this.f11619;
                if (j4 != Long.MIN_VALUE && jMo6103 > j4) {
                    z2 = false;
                }
            }
        }
        C0567.m1932(z2);
        for (int i2 = 0; i2 < interfaceC3823Arr.length; i2++) {
            if (interfaceC3823Arr2[i2] == null) {
                this.f11616[i2] = null;
            } else {
                C3792[] c3792Arr2 = this.f11616;
                if (c3792Arr2[i2] == null || c3792Arr2[i2].f11620 != interfaceC3823Arr2[i2]) {
                    this.f11616[i2] = new C3792(interfaceC3823Arr2[i2]);
                }
            }
            interfaceC3823Arr[i2] = this.f11616[i2];
        }
        return jMo6103;
    }

    @Override // p138.p176.p177.p190.p217.InterfaceC3798
    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public void mo6104(long j, boolean z) {
        this.f11614.mo6104(j, z);
    }

    @Override // p138.p176.p177.p190.p217.InterfaceC3798
    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public void mo6105(InterfaceC3798.InterfaceC3799 interfaceC3799, long j) {
        this.f11615 = interfaceC3799;
        this.f11614.mo6105(this, j);
    }

    @Override // p138.p176.p177.p190.p217.InterfaceC3798.InterfaceC3799
    /* JADX INFO: renamed from: ֏ */
    public void mo5538(InterfaceC3798 interfaceC3798) {
        InterfaceC3798.InterfaceC3799 interfaceC3799 = this.f11615;
        C0567.m1856(interfaceC3799);
        interfaceC3799.mo5538((InterfaceC3798) this);
    }

    @Override // p138.p176.p177.p190.p217.InterfaceC3824.InterfaceC3825
    /* JADX INFO: renamed from: ֏ */
    public void mo5541(InterfaceC3824 interfaceC3824) {
        InterfaceC3798.InterfaceC3799 interfaceC3799 = this.f11615;
        C0567.m1856(interfaceC3799);
        interfaceC3799.mo5541(this);
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public boolean m6106() {
        return this.f11617 != -9223372036854775807L;
    }

    @Override // p138.p176.p177.p190.p217.InterfaceC3798, p138.p176.p177.p190.p217.InterfaceC3824
    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public boolean mo6107(long j) {
        return this.f11614.mo6107(j);
    }

    @Override // p138.p176.p177.p190.p217.InterfaceC3798, p138.p176.p177.p190.p217.InterfaceC3824
    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public void mo6108(long j) {
        this.f11614.mo6108(j);
    }

    @Override // p138.p176.p177.p190.p217.InterfaceC3798, p138.p176.p177.p190.p217.InterfaceC3824
    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public boolean mo6109() {
        return this.f11614.mo6109();
    }

    @Override // p138.p176.p177.p190.p217.InterfaceC3798, p138.p176.p177.p190.p217.InterfaceC3824
    /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
    public long mo6110() {
        long jMo6110 = this.f11614.mo6110();
        if (jMo6110 != Long.MIN_VALUE) {
            long j = this.f11619;
            if (j == Long.MIN_VALUE || jMo6110 < j) {
                return jMo6110;
            }
        }
        return Long.MIN_VALUE;
    }

    /* JADX WARN: Removed duplicated region for block: B:16:0x0033  */
    @Override // p138.p176.p177.p190.p217.InterfaceC3798
    /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public long mo6111(long j) {
        this.f11617 = -9223372036854775807L;
        boolean z = false;
        for (C3792 c3792 : this.f11616) {
            if (c3792 != null) {
                c3792.f11621 = false;
            }
        }
        long jMo6111 = this.f11614.mo6111(j);
        if (jMo6111 == j) {
            z = true;
        } else if (jMo6111 >= this.f11618) {
            long j2 = this.f11619;
            if (j2 == Long.MIN_VALUE || jMo6111 <= j2) {
            }
        }
        C0567.m1932(z);
        return jMo6111;
    }

    @Override // p138.p176.p177.p190.p217.InterfaceC3798, p138.p176.p177.p190.p217.InterfaceC3824
    /* JADX INFO: renamed from: ށ, reason: contains not printable characters */
    public long mo6112() {
        long jMo6112 = this.f11614.mo6112();
        if (jMo6112 != Long.MIN_VALUE) {
            long j = this.f11619;
            if (j == Long.MIN_VALUE || jMo6112 < j) {
                return jMo6112;
            }
        }
        return Long.MIN_VALUE;
    }

    @Override // p138.p176.p177.p190.p217.InterfaceC3798
    /* JADX INFO: renamed from: ބ, reason: contains not printable characters */
    public long mo6113() {
        if (m6106()) {
            long j = this.f11617;
            this.f11617 = -9223372036854775807L;
            long jMo6113 = mo6113();
            return jMo6113 != -9223372036854775807L ? jMo6113 : j;
        }
        long jMo61132 = this.f11614.mo6113();
        if (jMo61132 == -9223372036854775807L) {
            return -9223372036854775807L;
        }
        boolean z = true;
        C0567.m1932(jMo61132 >= this.f11618);
        long j2 = this.f11619;
        if (j2 != Long.MIN_VALUE && jMo61132 > j2) {
            z = false;
        }
        C0567.m1932(z);
        return jMo61132;
    }

    @Override // p138.p176.p177.p190.p217.InterfaceC3798
    /* JADX INFO: renamed from: ޅ, reason: contains not printable characters */
    public C3829 mo6114() {
        return this.f11614.mo6114();
    }

    @Override // p138.p176.p177.p190.p217.InterfaceC3798
    /* JADX INFO: renamed from: ކ, reason: contains not printable characters */
    public void mo6115() {
        this.f11614.mo6115();
    }
}
