package F5;

import Z6.InterfaceC0382w;
import c7.K;
import com.google.android.gms.internal.measurement.C1;
import com.martsnew.domain.model.Genre;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;

/* JADX INFO: loaded from: classes.dex */
public final class B extends G6.i implements O6.p {

    /* JADX INFO: renamed from: u, reason: collision with root package name */
    public Object f2515u;

    /* JADX INFO: renamed from: v, reason: collision with root package name */
    public Genre f2516v;

    /* JADX INFO: renamed from: w, reason: collision with root package name */
    public int f2517w;

    /* JADX INFO: renamed from: x, reason: collision with root package name */
    public final /* synthetic */ C f2518x;

    /* JADX INFO: renamed from: y, reason: collision with root package name */
    public final /* synthetic */ int f2519y;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public B(C c3, int i, E6.d dVar) {
        super(2, dVar);
        this.f2518x = c3;
        this.f2519y = i;
    }

    @Override // O6.p
    public final Object k(Object obj, Object obj2) {
        return ((B) m((E6.d) obj2, (InterfaceC0382w) obj)).p(A6.n.f457a);
    }

    @Override // G6.a
    public final E6.d m(E6.d dVar, Object obj) {
        return new B(this.f2518x, this.f2519y, dVar);
    }

    @Override // G6.a
    public final Object p(Object obj) throws Throwable {
        Genre genre;
        C c3;
        Object obj2;
        F6.a aVar = F6.a.f2580q;
        int i = this.f2517w;
        A6.n nVar = A6.n.f457a;
        if (i == 0) {
            C1.N(obj);
            C c8 = this.f2518x;
            if (((List) c8.f2523g.e()).size() - this.f2519y <= 16 && (genre = c8.f2525j) != null) {
                HashMap map = c8.i;
                long j8 = genre.f11046q;
                Long l8 = new Long(j8);
                HashMap map2 = c8.i;
                Integer num = (Integer) map2.get(new Long(j8));
                map.put(l8, new Integer(num != null ? num.intValue() + 1 : 1));
                List listC = C1.C(new Long(j8));
                Integer num2 = (Integer) map2.get(new Long(j8));
                int iIntValue = num2 != null ? num2.intValue() : 1;
                this.f2515u = c8;
                this.f2516v = genre;
                this.f2517w = 1;
                Object objA = c8.f2521e.a(listC, iIntValue, 30, this);
                if (objA != aVar) {
                    c3 = c8;
                    obj2 = objA;
                }
                return aVar;
            }
            return nVar;
        }
        if (i != 1) {
            if (i != 2) {
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
            }
            C1.N(obj);
            return nVar;
        }
        genre = this.f2516v;
        c3 = (C) this.f2515u;
        C1.N(obj);
        obj2 = ((A6.j) obj).f449q;
        if (!(obj2 instanceof A6.i)) {
            ArrayList arrayListY0 = B6.k.y0((Collection) c3.f2523g.e());
            arrayListY0.addAll(((k5.m) obj2).f13982c);
            K k8 = c3.f2523g;
            k8.getClass();
            k8.g(null, arrayListY0);
            c3.f2524h.put(new Long(genre.f11046q), arrayListY0);
        }
        Throwable thA = A6.j.a(obj2);
        if (thA != null) {
            this.f2515u = obj2;
            this.f2516v = null;
            this.f2517w = 2;
            if (c3.f(thA, this) == aVar) {
                return aVar;
            }
        }
        return nVar;
    }
}
