package u0;

import androidx.collection.g0;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import d0.n;
import rm.n0;
import rm.y;
import s1.j0;
import tp.m0;

/* loaded from: classes.dex */
public final class c extends q {
    private final g0 N;

    /* loaded from: classes.dex */
    static final class a extends kotlin.coroutines.jvm.internal.l implements dn.p {

        /* renamed from: p, reason: collision with root package name */
        int f36652p;

        /* renamed from: q, reason: collision with root package name */
        final /* synthetic */ h f36653q;

        /* renamed from: r, reason: collision with root package name */
        final /* synthetic */ c f36654r;

        /* renamed from: s, reason: collision with root package name */
        final /* synthetic */ n.b f36655s;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        a(h hVar, c cVar, n.b bVar, vm.d dVar) {
            super(2, dVar);
            this.f36653q = hVar;
            this.f36654r = cVar;
            this.f36655s = bVar;
        }

        @Override // kotlin.coroutines.jvm.internal.a
        public final vm.d create(Object obj, vm.d dVar) {
            return new a(this.f36653q, this.f36654r, this.f36655s, dVar);
        }

        /* JADX WARN: Multi-variable type inference failed */
        /* JADX WARN: Type inference failed for: r3v4, types: [java.lang.Object, rm.n0] */
        @Override // kotlin.coroutines.jvm.internal.a
        public final Object invokeSuspend(Object obj) {
            Object f10;
            f10 = wm.d.f();
            int i10 = this.f36652p;
            try {
                if (i10 == 0) {
                    y.b(obj);
                    h hVar = this.f36653q;
                    this.f36652p = 1;
                    if (hVar.d(this) == f10) {
                        return f10;
                    }
                } else {
                    if (i10 != 1) {
                        throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                    }
                    y.b(obj);
                }
                this.f36654r.N.o(this.f36655s);
                j2.s.a(this.f36654r);
                this = n0.f34904a;
                return this;
            } catch (Throwable th2) {
                this.f36654r.N.o(this.f36655s);
                j2.s.a(this.f36654r);
                throw th2;
            }
        }

        @Override // dn.p
        public final Object invoke(m0 m0Var, vm.d dVar) {
            return ((a) create(m0Var, dVar)).invokeSuspend(n0.f34904a);
        }
    }

    public /* synthetic */ c(d0.j jVar, boolean z10, float f10, j0 j0Var, dn.a aVar, kotlin.jvm.internal.k kVar) {
        this(jVar, z10, f10, j0Var, aVar);
    }

    @Override // l1.i.c
    public void S1() {
        this.N.h();
    }

    @Override // u0.q
    public void m2(n.b bVar, long j10, float f10) {
        g0 g0Var = this.N;
        Object[] objArr = g0Var.f1367b;
        Object[] objArr2 = g0Var.f1368c;
        long[] jArr = g0Var.f1366a;
        int length = jArr.length - 2;
        if (length >= 0) {
            int i10 = 0;
            while (true) {
                long j11 = jArr[i10];
                if ((((~j11) << 7) & j11 & (-9187201950435737472L)) != -9187201950435737472L) {
                    int i11 = 8 - ((~(i10 - length)) >>> 31);
                    for (int i12 = 0; i12 < i11; i12++) {
                        if ((255 & j11) < 128) {
                            int i13 = (i10 << 3) + i12;
                            ((h) objArr2[i13]).h();
                        }
                        j11 >>= 8;
                    }
                    if (i11 != 8) {
                        break;
                    }
                }
                if (i10 == length) {
                    break;
                } else {
                    i10++;
                }
            }
        }
        h hVar = new h(o2() ? r1.g.d(bVar.a()) : null, f10, o2(), null);
        this.N.r(bVar, hVar);
        tp.k.d(H1(), null, null, new a(hVar, this, bVar, null), 3, null);
        j2.s.a(this);
    }

    @Override // u0.q
    public void n2(u1.f fVar) {
        float f10;
        int i10;
        float f11;
        int i11;
        int i12;
        int i13;
        int i14;
        float d10 = ((g) p2().invoke()).d();
        if (d10 == BitmapDescriptorFactory.HUE_RED) {
            return;
        }
        g0 g0Var = this.N;
        Object[] objArr = g0Var.f1367b;
        Object[] objArr2 = g0Var.f1368c;
        long[] jArr = g0Var.f1366a;
        int length = jArr.length - 2;
        if (length < 0) {
            return;
        }
        int i15 = 0;
        while (true) {
            long j10 = jArr[i15];
            if ((((~j10) << 7) & j10 & (-9187201950435737472L)) != -9187201950435737472L) {
                int i16 = 8;
                int i17 = 8 - ((~(i15 - length)) >>> 31);
                long j11 = j10;
                int i18 = 0;
                while (i18 < i17) {
                    if ((j11 & 255) < 128) {
                        int i19 = (i15 << 3) + i18;
                        float f12 = d10;
                        i11 = i18;
                        i12 = i17;
                        f11 = d10;
                        i13 = i15;
                        ((h) objArr2[i19]).e(fVar, s1.g0.l(q2(), f12, BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED, 14, null));
                        i14 = 8;
                    } else {
                        f11 = d10;
                        i11 = i18;
                        i12 = i17;
                        i13 = i15;
                        i14 = i16;
                    }
                    j11 >>= i14;
                    i18 = i11 + 1;
                    i15 = i13;
                    i16 = i14;
                    i17 = i12;
                    d10 = f11;
                }
                f10 = d10;
                i10 = i15;
                if (i17 != i16) {
                    return;
                }
            } else {
                f10 = d10;
                i10 = i15;
            }
            if (i10 == length) {
                return;
            }
            i15 = i10 + 1;
            d10 = f10;
        }
    }

    @Override // u0.q
    public void t2(n.b bVar) {
        h hVar = (h) this.N.b(bVar);
        if (hVar != null) {
            hVar.h();
        }
    }

    private c(d0.j jVar, boolean z10, float f10, j0 j0Var, dn.a aVar) {
        super(jVar, z10, f10, j0Var, aVar, null);
        this.N = new g0(0, 1, null);
    }
}
