package o;

import android.os.Handler;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* loaded from: classes.dex */
public final class U00 {
    public final C0692a8 a;
    public final C2258qf0 b;
    public final UQ c;
    public boolean d;
    public boolean e;
    public boolean f;
    public J1 g;
    public long h;
    public final U4 i;
    public final YQ j;

    public U00() {
        C0692a8 c0692a8 = new C0692a8(6, (byte) 0);
        c0692a8.c = new long[192];
        c0692a8.d = new long[192];
        this.a = c0692a8;
        this.b = new C2258qf0();
        this.c = new UQ();
        this.h = -1L;
        this.i = new U4(21, this);
        this.j = new YQ();
    }

    public static long a(AbstractC2239qS abstractC2239qS, long j) {
        float[] fArrB;
        int iF;
        InterfaceC1483iV interfaceC1483iV = abstractC2239qS.T;
        if (interfaceC1483iV == null || (iF = C1884mi0.f((fArrB = ((C1274gE) interfaceC1483iV).b()))) == 3) {
            return j;
        }
        if ((iF & 2) == 0) {
            return 9223372034707292159L;
        }
        return As0.P(C1570jO.b((Float.floatToRawIntBits((int) (j & 4294967295L)) & 4294967295L) | (Float.floatToRawIntBits((int) (j >> 32)) << 32), fArrB));
    }

    public static long h(C2420sK c2420sK) {
        C0312Mb c0312Mb = c2420sK.N;
        AbstractC2239qS abstractC2239qS = (AbstractC2239qS) c0312Mb.e;
        long jC = 0;
        for (AbstractC2239qS abstractC2239qS2 = (C2702vH) c0312Mb.d; abstractC2239qS2 != null && abstractC2239qS2 != abstractC2239qS; abstractC2239qS2 = abstractC2239qS2.B) {
            long jA = a(abstractC2239qS2, jC);
            if (C0704aI.a(jA, 9223372034707292159L)) {
                return 9223372034707292159L;
            }
            jC = C0704aI.c(jA, abstractC2239qS2.K);
        }
        return jC;
    }

    public static void i(C2420sK c2420sK) {
        long jH;
        AbstractC2239qS abstractC2239qS = (AbstractC2239qS) c2420sK.N.e;
        long jA = a(abstractC2239qS, 0L);
        long jC = 9223372034707292159L;
        if (!C1884mi0.i(jA)) {
            c2420sK.n = 9223372034707292159L;
            return;
        }
        long jC2 = C0704aI.c(jA, abstractC2239qS.K);
        C2420sK c2420sKS = c2420sK.s();
        if (c2420sKS != null) {
            if (!C1884mi0.i(c2420sKS.n)) {
                i(c2420sKS);
            }
            long j = c2420sKS.n;
            if (C1884mi0.i(j)) {
                if (c2420sKS.q) {
                    jH = h(c2420sKS);
                    c2420sKS.p = jH;
                    c2420sKS.q = false;
                } else {
                    jH = c2420sKS.p;
                }
                if (C1884mi0.i(jH)) {
                    jC = C0704aI.c(C0704aI.c(j, jH), jC2);
                }
            }
        } else {
            jC = jC2;
        }
        c2420sK.n = jC;
    }

    /* JADX WARN: Removed duplicated region for block: B:105:0x01c3  */
    /* JADX WARN: Removed duplicated region for block: B:42:0x00b9  */
    /* JADX WARN: Removed duplicated region for block: B:69:0x012e  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public final void b() {
        /*
            Method dump skipped, instructions count: 472
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: o.U00.b():void");
    }

    /* JADX WARN: Removed duplicated region for block: B:24:0x00e0  */
    /* JADX WARN: Removed duplicated region for block: B:26:0x00e4  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public final void c(o.C2420sK r22, boolean r23) {
        /*
            Method dump skipped, instructions count: 251
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: o.U00.c(o.sK, boolean):void");
    }

    public final void d(C2420sK c2420sK) {
        C1479iR c1479iRW = c2420sK.w();
        Object[] objArr = c1479iRW.l;
        int i = c1479iRW.n;
        for (int i2 = 0; i2 < i; i2++) {
            C2420sK c2420sK2 = (C2420sK) objArr[i2];
            c(c2420sK2, false);
            d(c2420sK2);
        }
    }

    public final void e(C2420sK c2420sK) {
        this.d = true;
        int i = c2420sK.m & 67108863;
        C0692a8 c0692a8 = this.a;
        long[] jArr = (long[]) c0692a8.c;
        int i2 = c0692a8.b;
        int i3 = 0;
        while (true) {
            if (i3 >= jArr.length - 2 || i3 >= i2) {
                break;
            }
            int i4 = i3 + 2;
            long j = jArr[i4];
            if ((((int) j) & 67108863) == i) {
                jArr[i4] = 2305843009213693952L | j;
                break;
            }
            i3 += 3;
        }
        k();
    }

    public final void f(C2420sK c2420sK) {
        long jH = h(c2420sK);
        if (!C1884mi0.i(jH)) {
            d(c2420sK);
            return;
        }
        c2420sK.p = jH;
        c2420sK.q = false;
        C1479iR c1479iRW = c2420sK.w();
        Object[] objArr = c1479iRW.l;
        int i = c1479iRW.n;
        for (int i2 = 0; i2 < i; i2++) {
            g((C2420sK) objArr[i2], false);
        }
        e(c2420sK);
    }

    /* JADX WARN: Removed duplicated region for block: B:53:0x016a  */
    /* JADX WARN: Removed duplicated region for block: B:55:0x016f  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public final void g(o.C2420sK r29, boolean r30) {
        /*
            Method dump skipped, instructions count: 400
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: o.U00.g(o.sK, boolean):void");
    }

    public final void j(C2420sK c2420sK) {
        int i = c2420sK.m & 67108863;
        C0692a8 c0692a8 = this.a;
        long[] jArr = (long[]) c0692a8.c;
        int i2 = c0692a8.b;
        int i3 = 0;
        while (true) {
            if (i3 >= jArr.length - 2 || i3 >= i2) {
                break;
            }
            int i4 = i3 + 2;
            if ((((int) jArr[i4]) & 67108863) == i) {
                jArr[i3] = -1;
                jArr[i3 + 1] = -1;
                jArr[i4] = 2305843009213693951L;
                break;
            }
            i3 += 3;
        }
        this.d = true;
        this.f = true;
    }

    public final void k() {
        J1 j1 = this.g;
        boolean z = j1 != null;
        long j = this.b.b;
        if (j >= 0 || !z) {
            if (this.h == j && z) {
                return;
            }
            if (j1 != null) {
                Handler handler = K1.a;
                K1.a.removeCallbacks(j1);
            }
            Handler handler2 = K1.a;
            long jCurrentTimeMillis = System.currentTimeMillis();
            long jMax = Math.max(j, 16 + jCurrentTimeMillis);
            this.h = jMax;
            J1 j12 = new J1(0, this.i);
            K1.a.postDelayed(j12, jMax - jCurrentTimeMillis);
            this.g = j12;
        }
    }
}
