package v;

import C0.AbstractC0123y;
import C0.C0116q;
import C0.C0124z;
import C0.InterfaceC0101b;
import java.util.ArrayList;
import m3.AbstractC2467b;
import w4.C3137A;
import x.H1;
import x4.AbstractC3251q;

/* JADX INFO: renamed from: v.t, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public final class C3049t extends C4.i implements J4.e {

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

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public /* synthetic */ Object f24948b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final /* synthetic */ C3051u f24949c;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public C3049t(C3051u c3051u, A4.d dVar) {
        super(2, dVar);
        this.f24949c = c3051u;
    }

    @Override // C4.a
    public final A4.d create(Object obj, A4.d dVar) {
        C3049t c3049t = new C3049t(this.f24949c, dVar);
        c3049t.f24948b = obj;
        return c3049t;
    }

    @Override // J4.e
    public final Object invoke(Object obj, Object obj2) {
        return ((C3049t) create((InterfaceC0101b) obj, (A4.d) obj2)).invokeSuspend(C3137A.f25453a);
    }

    /* JADX WARN: Code restructure failed: missing block: B:11:0x0036, code lost:
    
        if (r12 == r0) goto L16;
     */
    /* JADX WARN: Code restructure failed: missing block: B:15:0x004b, code lost:
    
        if (r12 != r0) goto L17;
     */
    /* JADX WARN: Code restructure failed: missing block: B:16:0x004d, code lost:
    
        return r0;
     */
    /* JADX WARN: Type inference failed for: r12v8, types: [java.lang.Object, java.util.Collection, java.util.List] */
    /* JADX WARN: Unsupported multi-entry loop pattern (BACK_EDGE: B:15:0x004b -> B:17:0x004e). Please report as a decompilation issue!!! */
    @Override // C4.a
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final Object invokeSuspend(Object obj) {
        InterfaceC0101b interfaceC0101b;
        Object obj2;
        B4.a aVar = B4.a.f492a;
        int i6 = this.f24947a;
        C3051u c3051u = this.f24949c;
        if (i6 == 0) {
            AbstractC2467b.l(obj);
            interfaceC0101b = (InterfaceC0101b) this.f24948b;
            this.f24948b = interfaceC0101b;
            this.f24947a = 1;
            obj = H1.b(interfaceC0101b, (2 & 1) != 0, C0.r.f634b, this);
        } else if (i6 == 1) {
            interfaceC0101b = (InterfaceC0101b) this.f24948b;
            AbstractC2467b.l(obj);
        } else {
            if (i6 != 2) {
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
            }
            interfaceC0101b = (InterfaceC0101b) this.f24948b;
            AbstractC2467b.l(obj);
            ?? r12 = ((C0116q) obj).f627a;
            ArrayList arrayList = new ArrayList(r12.size());
            int size = r12.size();
            int i7 = 0;
            for (int i8 = 0; i8 < size; i8++) {
                Object obj3 = r12.get(i8);
                if (((C0124z) obj3).f647d) {
                    arrayList.add(obj3);
                }
            }
            int size2 = arrayList.size();
            while (true) {
                if (i7 >= size2) {
                    obj2 = null;
                    break;
                }
                obj2 = arrayList.get(i7);
                if (AbstractC0123y.e(((C0124z) obj2).f644a, c3051u.f24957h)) {
                    break;
                }
                i7++;
            }
            C0124z c0124z = (C0124z) obj2;
            if (c0124z == null) {
                c0124z = (C0124z) AbstractC3251q.g0(arrayList);
            }
            if (c0124z != null) {
                c3051u.f24957h = c0124z.f644a;
                c3051u.f24951b = c0124z.f646c;
            }
            if (arrayList.isEmpty()) {
                c3051u.f24957h = -1L;
                return C3137A.f25453a;
            }
            this.f24948b = interfaceC0101b;
            this.f24947a = 2;
            obj = ((C0.Y) interfaceC0101b).d(C0.r.f634b, this);
        }
        C0124z c0124z2 = (C0124z) obj;
        c3051u.f24957h = c0124z2.f644a;
        c3051u.f24951b = c0124z2.f646c;
        this.f24948b = interfaceC0101b;
        this.f24947a = 2;
        obj = ((C0.Y) interfaceC0101b).d(C0.r.f634b, this);
    }
}
