package o; import com.airbnb.deeplinkdispatch.UrlTreeKt; import java.util.ArrayList; import java.util.Collections; import java.util.IdentityHashMap; import java.util.Iterator; import java.util.Set; import java.util.concurrent.CancellationException; import java.util.concurrent.atomic.AtomicReferenceFieldUpdater; import kotlinx.coroutines.JobCancellationException; import kotlinx.coroutines.TimeoutCancellationException; import o.C14930gcM; import o.InterfaceC14912gbn; import o.ggU; /* loaded from: classes.dex */ public class gfH implements geD, gfR { static final AtomicReferenceFieldUpdater a = AtomicReferenceFieldUpdater.newUpdater(gfH.class, Object.class, "_state"); public volatile Object _parentHandle; volatile Object _state; /* JADX INFO: Access modifiers changed from: protected */ public void a(Object obj) { } protected boolean a(Throwable th) { return false; } protected void b(Object obj) { } public boolean bt_() { return true; } protected boolean g() { return false; } public boolean i() { return false; } protected void j() { } public gfH(boolean z) { C15051gfk c15051gfk; if (!z) { c15051gfk = gfM.e; } else { c15051gfk = gfM.a; } this._state = c15051gfk; this._parentHandle = null; } @Override // o.InterfaceC14912gbn.Sts public final InterfaceC14912gbn.HBt getKey() { return InterfaceC15034gfD.d; } /* loaded from: classes.dex */ public static final class IeS extends ggU.HBt { private Object c; private gfH d; /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ public IeS(ggU ggu, gfH gfh, Object obj) { super(ggu); this.d = gfh; this.c = obj; } @Override // o.ggF public final /* synthetic */ Object e(ggU ggu) { Object obj; gfH gfh = this.d; while (true) { obj = gfh._state; if (!(obj instanceof AbstractC15115ghd)) { break; } ((AbstractC15115ghd) obj).a(gfh); } if (obj == this.c) { return null; } return ggT.a(); } } /* JADX INFO: Access modifiers changed from: protected */ public final void d(InterfaceC15034gfD interfaceC15034gfD) { Object obj; C15045gfe.b(); if (interfaceC15034gfD != null) { interfaceC15034gfD.h(); InterfaceC14998geG c = interfaceC15034gfD.c(this); this._parentHandle = c; while (true) { obj = this._state; if (!(obj instanceof AbstractC15115ghd)) { break; } else { ((AbstractC15115ghd) obj).a(this); } } if (!(obj instanceof InterfaceC15064gfx)) { c.e(); this._parentHandle = gfL.d; return; } return; } this._parentHandle = gfL.d; } @Override // o.InterfaceC15034gfD public boolean d() { Object obj; while (true) { obj = this._state; if (!(obj instanceof AbstractC15115ghd)) { break; } ((AbstractC15115ghd) obj).a(this); } return (obj instanceof InterfaceC15064gfx) && ((InterfaceC15064gfx) obj).bv_(); } /* JADX WARN: Multi-variable type inference failed */ private final Object d(LWm lWm, Object obj) { ArrayList arrayList; C15119ghh c15119ghh; Object obj2; C15045gfe.b(); C15045gfe.b(); C15045gfe.b(); Throwable th = null; C15000geK c15000geK = obj instanceof C15000geK ? (C15000geK) obj : null; Throwable th2 = c15000geK != null ? c15000geK.d : null; synchronized (lWm) { Object obj3 = lWm._exceptionsHolder; if (obj3 != null) { if (!(obj3 instanceof Throwable)) { if (!(obj3 instanceof ArrayList)) { throw new IllegalStateException("State is ".concat(String.valueOf(obj3)).toString()); } arrayList = (ArrayList) obj3; } else { ArrayList arrayList2 = new ArrayList(4); arrayList2.add(obj3); arrayList = arrayList2; } } else { arrayList = new ArrayList(4); } Throwable th3 = (Throwable) lWm._rootCause; if (th3 != null) { arrayList.add(0, th3); } if (th2 != null && !C14957gcv.b(th2, th3)) { arrayList.add(th2); } c15119ghh = gfM.g; lWm._exceptionsHolder = c15119ghh; ArrayList arrayList3 = arrayList; if (!arrayList3.isEmpty()) { ArrayList arrayList4 = arrayList3; Iterator it = arrayList4.iterator(); while (true) { if (!it.hasNext()) { obj2 = null; break; } obj2 = it.next(); if (!(((Throwable) obj2) instanceof CancellationException)) { break; } } Throwable th4 = (Throwable) obj2; if (th4 != null) { th = th4; } else { Throwable th5 = (Throwable) arrayList3.get(0); if (th5 instanceof TimeoutCancellationException) { Iterator it2 = arrayList4.iterator(); while (true) { if (!it2.hasNext()) { break; } Object next = it2.next(); Throwable th6 = (Throwable) next; if (th6 != th5 && (th6 instanceof TimeoutCancellationException)) { th = next; break; } } th = th; if (th != null) { } } th = th5; } } else if (((Throwable) lWm._rootCause) != null) { th = new JobCancellationException(b(), null, this); } if (th != null && arrayList3.size() > 1) { Set newSetFromMap = Collections.newSetFromMap(new IdentityHashMap(arrayList3.size())); Throwable e = !C15045gfe.a() ? th : C15120ghi.e(th); for (Throwable th7 : arrayList3) { if (C15045gfe.a()) { th7 = C15120ghi.e(th7); } if (th7 != th && th7 != e && !(th7 instanceof CancellationException) && newSetFromMap.add(th7)) { C14957gcv.e(th, ""); C14957gcv.e(th7, ""); if (th != th7) { C14887gbC.c.d(th, th7); } } } } } if (th != null && th != th2) { obj = new C15000geK(th); } if (th != null && (c(th) || a(th))) { if (obj == null) { throw new NullPointerException("null cannot be cast to non-null type kotlinx.coroutines.CompletedExceptionally"); } C15000geK.c.compareAndSet((C15000geK) obj, 0, 1); } b(obj); AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = a; Object d = gfM.d(obj); while (!atomicReferenceFieldUpdater.compareAndSet(this, lWm, d) && atomicReferenceFieldUpdater.get(this) == lWm) { } C15045gfe.b(); b(lWm, obj); return obj; } private final boolean c(InterfaceC15064gfx interfaceC15064gfx, Object obj) { C15045gfe.b(); C15045gfe.b(); AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = a; Object d = gfM.d(obj); while (!atomicReferenceFieldUpdater.compareAndSet(this, interfaceC15064gfx, d)) { if (atomicReferenceFieldUpdater.get(this) != interfaceC15064gfx) { return false; } } b(obj); b(interfaceC15064gfx, obj); return true; } /* JADX WARN: Code restructure failed: missing block: B:33:0x0081, code lost: if (r6 == null) goto L39; */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ private final void b(o.InterfaceC15064gfx r9, java.lang.Object r10) { /* r8 = this; java.lang.Object r0 = r8._parentHandle o.geG r0 = (o.InterfaceC14998geG) r0 if (r0 == 0) goto Lf r0.e() o.gfL r0 = o.gfL.d o.geG r0 = (o.InterfaceC14998geG) r0 r8._parentHandle = r0 Lf: boolean r0 = r10 instanceof o.C15000geK r1 = 0 if (r0 == 0) goto L17 o.geK r10 = (o.C15000geK) r10 goto L18 L17: r10 = r1 L18: if (r10 == 0) goto L1d java.lang.Throwable r10 = r10.d goto L1e L1d: r10 = r1 L1e: boolean r0 = r9 instanceof o.gfF java.lang.String r2 = " for " java.lang.String r3 = "Exception in completion handler " if (r0 == 0) goto L4b r0 = r9 o.gfF r0 = (o.gfF) r0 // Catch: java.lang.Throwable -> L2d r0.b(r10) // Catch: java.lang.Throwable -> L2d return L2d: r10 = move-exception kotlinx.coroutines.CompletionHandlerException r0 = new kotlinx.coroutines.CompletionHandlerException java.lang.StringBuilder r1 = new java.lang.StringBuilder r1.(r3) r1.append(r9) r1.append(r2) r1.append(r8) java.lang.String r9 = r1.toString() r0.(r9, r10) java.lang.Throwable r0 = (java.lang.Throwable) r0 r8.b(r0) return L4b: o.gfI r9 = r9.a() if (r9 == 0) goto Lbd o.ggR r9 = (o.ggR) r9 L53: java.lang.Object r0 = r9._next boolean r4 = r0 instanceof o.AbstractC15115ghd if (r4 != 0) goto Lb7 o.ggU r0 = (o.ggU) r0 L5b: boolean r4 = o.C14957gcv.b(r0, r9) if (r4 != 0) goto Laf boolean r4 = r0 instanceof o.gfF if (r4 == 0) goto L9c r4 = r0 o.gfF r4 = (o.gfF) r4 r4.b(r10) // Catch: java.lang.Throwable -> L6c goto L9c L6c: r5 = move-exception r6 = r1 java.lang.Throwable r6 = (java.lang.Throwable) r6 if (r6 == 0) goto L83 java.lang.String r7 = "" o.C14957gcv.e(r6, r7) o.C14957gcv.e(r5, r7) if (r6 == r5) goto L81 o.gbA r7 = o.C14887gbC.c r7.d(r6, r5) L81: if (r6 != 0) goto L9c L83: kotlinx.coroutines.CompletionHandlerException r1 = new kotlinx.coroutines.CompletionHandlerException java.lang.StringBuilder r6 = new java.lang.StringBuilder r6.(r3) r6.append(r4) r6.append(r2) r6.append(r8) java.lang.String r4 = r6.toString() r1.(r4, r5) o.gag r4 = o.C14866gag.c L9c: r4 = r1 L9d: java.lang.Object r1 = r0._next boolean r5 = r1 instanceof o.AbstractC15115ghd if (r5 != 0) goto La9 o.ggU r0 = o.ggT.d(r1) r1 = r4 goto L5b La9: o.ghd r1 = (o.AbstractC15115ghd) r1 r1.a(r0) goto L9d Laf: java.lang.Throwable r1 = (java.lang.Throwable) r1 if (r1 == 0) goto Lbd r8.b(r1) goto Lbd Lb7: o.ghd r0 = (o.AbstractC15115ghd) r0 r0.a(r9) goto L53 Lbd: return */ throw new UnsupportedOperationException("Method not decompiled: o.gfH.b(o.gfx, java.lang.Object):void"); } private final boolean c(Throwable th) { if (g()) { return true; } boolean z = th instanceof CancellationException; InterfaceC14998geG interfaceC14998geG = (InterfaceC14998geG) this._parentHandle; return (interfaceC14998geG == null || interfaceC14998geG == gfL.d) ? z : interfaceC14998geG.e(th) || z; } @Override // o.InterfaceC15034gfD public final CancellationException e() { Object obj; while (true) { obj = this._state; if (!(obj instanceof AbstractC15115ghd)) { break; } ((AbstractC15115ghd) obj).a(this); } if (!(obj instanceof LWm)) { if (obj instanceof InterfaceC15064gfx) { throw new IllegalStateException("Job is still new or active: ".concat(String.valueOf(this)).toString()); } if (!(obj instanceof C15000geK)) { StringBuilder sb = new StringBuilder(); sb.append(C15041gfa.a(this)); sb.append(" has completed normally"); return new JobCancellationException(sb.toString(), null, this); } return d(((C15000geK) obj).d, (String) null); } Throwable th = (Throwable) ((LWm) obj)._rootCause; if (th != null) { StringBuilder sb2 = new StringBuilder(); sb2.append(C15041gfa.a(this)); sb2.append(" is cancelling"); CancellationException d = d(th, sb2.toString()); if (d != null) { return d; } } throw new IllegalStateException("Job is still new or active: ".concat(String.valueOf(this)).toString()); } private CancellationException d(Throwable th, String str) { CancellationException cancellationException = th instanceof CancellationException ? (CancellationException) th : null; if (cancellationException != null) { return cancellationException; } if (str == null) { str = b(); } return new JobCancellationException(str, th, this); } private final boolean d(Object obj, gfI gfi, gfF gff) { int e; gfI gfi2 = gfi; gfF gff2 = gff; IeS ieS = new IeS(gff2, this, obj); do { ggU b = gfi2.b(); if (b == null) { b = ggU.a((ggU) gfi2._prev); } e = b.e(gff2, gfi2, ieS); if (e == 1) { return true; } } while (e != 2); return false; } private final void d(gfF gff) { Object obj; gff.e(new gfI()); while (true) { obj = gff._next; if (!(obj instanceof AbstractC15115ghd)) { break; } else { ((AbstractC15115ghd) obj).a(gff); } } ggU d = ggT.d(obj); AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = a; while (!atomicReferenceFieldUpdater.compareAndSet(this, gff, d) && atomicReferenceFieldUpdater.get(this) == gff) { } } @Override // o.geD public final void a(gfR gfr) { e(gfr); } public final boolean e(Object obj) { Object obj2; C15119ghh c15119ghh; C15119ghh c15119ghh2; C15119ghh c15119ghh3; obj2 = gfM.c; if (i() && (obj2 = c(obj)) == gfM.d) { return true; } c15119ghh = gfM.c; if (obj2 == c15119ghh) { obj2 = i(obj); } c15119ghh2 = gfM.c; if (obj2 == c15119ghh2 || obj2 == gfM.d) { return true; } c15119ghh3 = gfM.f; if (obj2 == c15119ghh3) { return false; } a(obj2); return true; } /* JADX WARN: Multi-variable type inference failed */ /* JADX WARN: Type inference failed for: r1v13, types: [java.lang.Throwable] */ /* JADX WARN: Type inference failed for: r1v8, types: [java.lang.Throwable] */ @Override // o.gfR public final CancellationException f() { Object obj; CancellationException cancellationException; while (true) { obj = this._state; if (!(obj instanceof AbstractC15115ghd)) { break; } ((AbstractC15115ghd) obj).a(this); } if (!(obj instanceof LWm)) { if (obj instanceof C15000geK) { cancellationException = ((C15000geK) obj).d; } else { if (obj instanceof InterfaceC15064gfx) { throw new IllegalStateException("Cannot be cancelling child in this state: ".concat(String.valueOf(obj)).toString()); } cancellationException = null; } } else { cancellationException = (Throwable) ((LWm) obj)._rootCause; } CancellationException cancellationException2 = cancellationException instanceof CancellationException ? cancellationException : null; if (cancellationException2 != null) { return cancellationException2; } StringBuilder sb = new StringBuilder("Parent job is "); sb.append(f(obj)); return new JobCancellationException(sb.toString(), cancellationException, this); } private final Throwable g(Object obj) { if (obj == null || (obj instanceof Throwable)) { Throwable th = (Throwable) obj; return th == null ? new JobCancellationException(b(), null, this) : th; } if (obj != null) { return ((gfR) obj).f(); } throw new NullPointerException("null cannot be cast to non-null type kotlinx.coroutines.ParentJob"); } private final gfI c(InterfaceC15064gfx interfaceC15064gfx) { gfI a2 = interfaceC15064gfx.a(); if (a2 != null) { return a2; } if (interfaceC15064gfx instanceof C15051gfk) { return new gfI(); } if (interfaceC15064gfx instanceof gfF) { d((gfF) interfaceC15064gfx); return null; } throw new IllegalStateException("State should have list: ".concat(String.valueOf(interfaceC15064gfx)).toString()); } private final Object e(Object obj, Object obj2) { C15119ghh c15119ghh; C15119ghh c15119ghh2; if (obj instanceof InterfaceC15064gfx) { if (((obj instanceof C15051gfk) || (obj instanceof gfF)) && !(obj instanceof C14996geE) && !(obj2 instanceof C15000geK)) { if (c((InterfaceC15064gfx) obj, obj2)) { return obj2; } c15119ghh = gfM.b; return c15119ghh; } return a((InterfaceC15064gfx) obj, obj2); } c15119ghh2 = gfM.c; return c15119ghh2; } /* JADX WARN: Multi-variable type inference failed */ private final Object a(InterfaceC15064gfx interfaceC15064gfx, Object obj) { C15119ghh c15119ghh; C15119ghh c15119ghh2; C15119ghh c15119ghh3; gfI c = c(interfaceC15064gfx); if (c != null) { C14996geE c14996geE = null; LWm lWm = interfaceC15064gfx instanceof LWm ? (LWm) interfaceC15064gfx : null; if (lWm == null) { lWm = new LWm(c, null); } C14930gcM.RVV rvv = new C14930gcM.RVV(); synchronized (lWm) { if (lWm._isCompleting == 0) { lWm._isCompleting = 1; if (lWm != interfaceC15064gfx) { AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = a; while (!atomicReferenceFieldUpdater.compareAndSet(this, interfaceC15064gfx, lWm)) { if (atomicReferenceFieldUpdater.get(this) != interfaceC15064gfx) { c15119ghh = gfM.b; return c15119ghh; } } } C15045gfe.b(); boolean z = ((Throwable) lWm._rootCause) != null; C15000geK c15000geK = obj instanceof C15000geK ? (C15000geK) obj : null; if (c15000geK != null) { lWm.c(c15000geK.d); } rvv.d = true ^ z ? (Throwable) lWm._rootCause : 0; C14866gag c14866gag = C14866gag.c; Throwable th = (Throwable) rvv.d; if (th != null) { a(c, th); } C14996geE c14996geE2 = interfaceC15064gfx instanceof C14996geE ? (C14996geE) interfaceC15064gfx : null; if (c14996geE2 == null) { gfI a2 = interfaceC15064gfx.a(); if (a2 != null) { c14996geE = a((ggU) a2); } } else { c14996geE = c14996geE2; } if (c14996geE != null && d(lWm, c14996geE, obj)) { return gfM.d; } return d(lWm, obj); } c15119ghh2 = gfM.c; return c15119ghh2; } } c15119ghh3 = gfM.b; return c15119ghh3; } private final boolean d(LWm lWm, C14996geE c14996geE, Object obj) { while (c14996geE.a.c(false, false, new Sts(this, lWm, c14996geE, obj)) == gfL.d) { c14996geE = a((ggU) c14996geE); if (c14996geE == null) { return false; } } return true; } private static C14996geE a(ggU ggu) { while (ggu.bu_()) { ggU b = ggu.b(); ggu = b == null ? ggU.a((ggU) ggu._prev) : b; } while (true) { Object obj = ggu._next; if (!(obj instanceof AbstractC15115ghd)) { ggu = ggT.d(obj); if (ggu.bu_()) { continue; } else { if (ggu instanceof C14996geE) { return (C14996geE) ggu; } if (ggu instanceof gfI) { return null; } } } else { ((AbstractC15115ghd) obj).a(ggu); } } } @Override // o.InterfaceC15034gfD public final InterfaceC14998geG c(geD ged) { return (InterfaceC14998geG) c(true, true, new C14996geE(ged)); } public void b(Throwable th) { throw th; } public String toString() { StringBuilder sb = new StringBuilder(); StringBuilder sb2 = new StringBuilder(); sb2.append(a()); sb2.append(UrlTreeKt.componentParamPrefixChar); while (true) { Object obj = this._state; if (obj instanceof AbstractC15115ghd) { ((AbstractC15115ghd) obj).a(this); } else { sb2.append(f(obj)); sb2.append(UrlTreeKt.componentParamSuffixChar); sb.append(sb2.toString()); sb.append('@'); sb.append(C15041gfa.b(this)); return sb.toString(); } } } public String a() { return C15041gfa.a(this); } private static String f(Object obj) { if (obj instanceof LWm) { LWm lWm = (LWm) obj; if (((Throwable) lWm._rootCause) != null) { return "Cancelling"; } if (lWm._isCompleting != 0) { return "Completing"; } } else { if (!(obj instanceof InterfaceC15064gfx)) { return obj instanceof C15000geK ? "Cancelled" : "Completed"; } if (!((InterfaceC15064gfx) obj).bv_()) { return "New"; } } return "Active"; } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes.dex */ public static final class LWm implements InterfaceC15064gfx { volatile Object _rootCause; final gfI b; volatile int _isCompleting = 0; volatile Object _exceptionsHolder = null; public LWm(gfI gfi, Throwable th) { this.b = gfi; this._rootCause = th; } @Override // o.InterfaceC15064gfx public final boolean bv_() { return ((Throwable) this._rootCause) == null; } public final void c(Throwable th) { Throwable th2 = (Throwable) this._rootCause; if (th2 == null) { this._rootCause = th; return; } if (th == th2) { return; } Object obj = this._exceptionsHolder; if (obj != null) { if (!(obj instanceof Throwable)) { if (!(obj instanceof ArrayList)) { throw new IllegalStateException("State is ".concat(String.valueOf(obj)).toString()); } ((ArrayList) obj).add(th); return; } else { if (th == obj) { return; } ArrayList arrayList = new ArrayList(4); arrayList.add(obj); arrayList.add(th); this._exceptionsHolder = arrayList; return; } } this._exceptionsHolder = th; } /* JADX WARN: Multi-variable type inference failed */ /* JADX WARN: Type inference failed for: r1v6, types: [int, boolean] */ public final String toString() { StringBuilder sb = new StringBuilder("Finishing[cancelling="); sb.append(((Throwable) this._rootCause) != null); sb.append(", completing="); sb.append((boolean) this._isCompleting); sb.append(", rootCause="); sb.append((Throwable) this._rootCause); sb.append(", exceptions="); sb.append(this._exceptionsHolder); sb.append(", list="); sb.append(this.b); sb.append(']'); return sb.toString(); } @Override // o.InterfaceC15064gfx public final gfI a() { return this.b; } } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes.dex */ public static final class Sts extends gfF { private final gfH a; private final C14996geE d; private final Object f; private final LWm g; @Override // o.InterfaceC14894gbR public final /* synthetic */ C14866gag invoke(Throwable th) { gfH.e(this.a, this.g, this.d, this.f); return C14866gag.c; } public Sts(gfH gfh, LWm lWm, C14996geE c14996geE, Object obj) { this.a = gfh; this.g = lWm; this.d = c14996geE; this.f = obj; } @Override // o.geN public final void b(Throwable th) { gfH.e(this.a, this.g, this.d, this.f); } } /* JADX WARN: Code restructure failed: missing block: B:21:0x0031, code lost: if (r4 == null) goto L20; */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ private final void a(o.gfI r7, java.lang.Throwable r8) { /* r6 = this; o.ggR r7 = (o.ggR) r7 L2: java.lang.Object r0 = r7._next boolean r1 = r0 instanceof o.AbstractC15115ghd if (r1 != 0) goto L6e o.ggU r0 = (o.ggU) r0 r1 = 0 Lb: boolean r2 = o.C14957gcv.b(r0, r7) if (r2 != 0) goto L63 boolean r2 = r0 instanceof o.gfC if (r2 == 0) goto L50 r2 = r0 o.gfF r2 = (o.gfF) r2 r2.b(r8) // Catch: java.lang.Throwable -> L1c goto L50 L1c: r3 = move-exception r4 = r1 java.lang.Throwable r4 = (java.lang.Throwable) r4 if (r4 == 0) goto L33 java.lang.String r5 = "" o.C14957gcv.e(r4, r5) o.C14957gcv.e(r3, r5) if (r4 == r3) goto L31 o.gbA r5 = o.C14887gbC.c r5.d(r4, r3) L31: if (r4 != 0) goto L50 L33: kotlinx.coroutines.CompletionHandlerException r1 = new kotlinx.coroutines.CompletionHandlerException java.lang.StringBuilder r4 = new java.lang.StringBuilder java.lang.String r5 = "Exception in completion handler " r4.(r5) r4.append(r2) java.lang.String r2 = " for " r4.append(r2) r4.append(r6) java.lang.String r2 = r4.toString() r1.(r2, r3) o.gag r2 = o.C14866gag.c L50: r2 = r1 L51: java.lang.Object r1 = r0._next boolean r3 = r1 instanceof o.AbstractC15115ghd if (r3 != 0) goto L5d o.ggU r0 = o.ggT.d(r1) r1 = r2 goto Lb L5d: o.ghd r1 = (o.AbstractC15115ghd) r1 r1.a(r0) goto L51 L63: java.lang.Throwable r1 = (java.lang.Throwable) r1 if (r1 == 0) goto L6a r6.b(r1) L6a: r6.c(r8) return L6e: o.ghd r0 = (o.AbstractC15115ghd) r0 r0.a(r7) goto L2 */ throw new UnsupportedOperationException("Method not decompiled: o.gfH.a(o.gfI, java.lang.Throwable):void"); } /* JADX WARN: Removed duplicated region for block: B:19:0x004b */ /* JADX WARN: Removed duplicated region for block: B:24:0x004e A[SYNTHETIC] */ @Override // o.InterfaceC15034gfD /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ public final boolean h() { /* r7 = this; L0: java.lang.Object r0 = r7._state boolean r1 = r0 instanceof o.AbstractC15115ghd if (r1 != 0) goto L4f boolean r1 = r0 instanceof o.C15051gfk r2 = -1 r3 = 0 r4 = 1 if (r1 == 0) goto L2b r1 = r0 o.gfk r1 = (o.C15051gfk) r1 boolean r1 = r1.d if (r1 != 0) goto L48 java.util.concurrent.atomic.AtomicReferenceFieldUpdater r1 = o.gfH.a o.gfk r5 = o.gfM.a() L1a: boolean r6 = r1.compareAndSet(r7, r0, r5) if (r6 == 0) goto L24 r7.j() goto L3f L24: java.lang.Object r6 = r1.get(r7) if (r6 == r0) goto L1a goto L49 L2b: boolean r1 = r0 instanceof o.C15062gfv if (r1 == 0) goto L48 java.util.concurrent.atomic.AtomicReferenceFieldUpdater r1 = o.gfH.a r5 = r0 o.gfv r5 = (o.C15062gfv) r5 o.gfI r5 = r5.b L36: boolean r6 = r1.compareAndSet(r7, r0, r5) if (r6 == 0) goto L41 r7.j() L3f: r2 = r4 goto L49 L41: java.lang.Object r6 = r1.get(r7) if (r6 == r0) goto L36 goto L49 L48: r2 = r3 L49: if (r2 == 0) goto L4e if (r2 != r4) goto L0 return r4 L4e: return r3 L4f: o.ghd r0 = (o.AbstractC15115ghd) r0 r0.a(r7) goto L0 */ throw new UnsupportedOperationException("Method not decompiled: o.gfH.h():boolean"); } @Override // o.InterfaceC15034gfD public final void d(CancellationException cancellationException) { if (cancellationException == null) { cancellationException = new JobCancellationException(b(), null, this); } e(cancellationException); } private final Object c(Object obj) { C15119ghh c15119ghh; C15119ghh c15119ghh2; while (true) { Object obj2 = this._state; if (!(obj2 instanceof AbstractC15115ghd)) { if (!(obj2 instanceof InterfaceC15064gfx) || ((obj2 instanceof LWm) && ((LWm) obj2)._isCompleting != 0)) { break; } Object e = e(obj2, new C15000geK(g(obj))); c15119ghh2 = gfM.b; if (e != c15119ghh2) { return e; } } else { ((AbstractC15115ghd) obj2).a(this); } } c15119ghh = gfM.c; return c15119ghh; } private final Object i(Object obj) { C15119ghh c15119ghh; C15119ghh c15119ghh2; C15119ghh c15119ghh3; C15119ghh c15119ghh4; C15119ghh c15119ghh5; C15119ghh c15119ghh6; C15119ghh c15119ghh7; Throwable th = null; while (true) { Object obj2 = this._state; if (!(obj2 instanceof AbstractC15115ghd)) { if (!(obj2 instanceof LWm)) { if (obj2 instanceof InterfaceC15064gfx) { if (th == null) { th = g(obj); } InterfaceC15064gfx interfaceC15064gfx = (InterfaceC15064gfx) obj2; if (!interfaceC15064gfx.bv_()) { Object e = e(obj2, new C15000geK(th)); c15119ghh6 = gfM.c; if (e == c15119ghh6) { throw new IllegalStateException("Cannot happen in ".concat(String.valueOf(obj2)).toString()); } c15119ghh7 = gfM.b; if (e != c15119ghh7) { return e; } } else { C15045gfe.b(); C15045gfe.b(); gfI c = c(interfaceC15064gfx); if (c != null) { LWm lWm = new LWm(c, th); AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = a; while (!atomicReferenceFieldUpdater.compareAndSet(this, interfaceC15064gfx, lWm)) { if (atomicReferenceFieldUpdater.get(this) != interfaceC15064gfx) { break; } } a(c, th); c15119ghh5 = gfM.c; return c15119ghh5; } continue; } } else { c15119ghh4 = gfM.f; return c15119ghh4; } } else { synchronized (obj2) { Object obj3 = ((LWm) obj2)._exceptionsHolder; c15119ghh = gfM.g; if (obj3 != c15119ghh) { boolean z = ((Throwable) ((LWm) obj2)._rootCause) != null; if (obj != null || !z) { if (th == null) { th = g(obj); } ((LWm) obj2).c(th); } Throwable th2 = z ^ true ? (Throwable) ((LWm) obj2)._rootCause : null; if (th2 != null) { a(((LWm) obj2).b, th2); } c15119ghh2 = gfM.c; return c15119ghh2; } c15119ghh3 = gfM.f; return c15119ghh3; } } } else { ((AbstractC15115ghd) obj2).a(this); } } } public final Object d(Object obj) { C15119ghh c15119ghh; C15119ghh c15119ghh2; while (true) { Object obj2 = this._state; if (!(obj2 instanceof AbstractC15115ghd)) { Object e = e(obj2, obj); c15119ghh = gfM.c; if (e == c15119ghh) { StringBuilder sb = new StringBuilder("Job "); sb.append(this); sb.append(" is already complete or completing, but is being completed with "); sb.append(obj); String obj3 = sb.toString(); C15000geK c15000geK = obj instanceof C15000geK ? (C15000geK) obj : null; throw new IllegalStateException(obj3, c15000geK != null ? c15000geK.d : null); } c15119ghh2 = gfM.b; if (e != c15119ghh2) { return e; } } else { ((AbstractC15115ghd) obj2).a(this); } } } public static final /* synthetic */ void e(gfH gfh, LWm lWm, C14996geE c14996geE, Object obj) { C15045gfe.b(); C14996geE a2 = a((ggU) c14996geE); if (a2 == null || !gfh.d(lWm, a2, obj)) { gfh.a(gfh.d(lWm, obj)); } } @Override // o.InterfaceC14912gbn public R fold(R r, InterfaceC14937gcb interfaceC14937gcb) { C14957gcv.e(interfaceC14937gcb, ""); return interfaceC14937gcb.invoke(r, this); } @Override // o.InterfaceC14912gbn.Sts, o.InterfaceC14912gbn public E get(InterfaceC14912gbn.HBt hBt) { gfH gfh = this; C14957gcv.e(hBt, ""); if (!C14957gcv.b(gfh.getKey(), hBt)) { return null; } C14957gcv.d(gfh, ""); return gfh; } @Override // o.InterfaceC14912gbn public InterfaceC14912gbn minusKey(InterfaceC14912gbn.HBt hBt) { gfH gfh = this; C14957gcv.e(hBt, ""); boolean b = C14957gcv.b(gfh.getKey(), hBt); InterfaceC14912gbn interfaceC14912gbn = gfh; if (b) { interfaceC14912gbn = C14908gbj.e; } return interfaceC14912gbn; } @Override // o.InterfaceC14912gbn public InterfaceC14912gbn plus(InterfaceC14912gbn interfaceC14912gbn) { C14957gcv.e(interfaceC14912gbn, ""); gfH gfh = this; C14957gcv.e(interfaceC14912gbn, ""); return interfaceC14912gbn != C14908gbj.e ? (InterfaceC14912gbn) interfaceC14912gbn.fold(gfh, InterfaceC14912gbn.IeS.C0117IeS.a) : gfh; } @Override // o.InterfaceC15034gfD public final InterfaceC15056gfp c(boolean z, boolean z2, InterfaceC14894gbR interfaceC14894gbR) { C15033gfB c15033gfB; Throwable th; if (z) { gfA gfa = interfaceC14894gbR instanceof gfC ? (gfC) interfaceC14894gbR : null; if (gfa == null) { gfa = new gfA(interfaceC14894gbR); } c15033gfB = gfa; } else { c15033gfB = interfaceC14894gbR instanceof gfF ? (gfF) interfaceC14894gbR : null; if (c15033gfB != null) { C15045gfe.b(); } else { c15033gfB = new C15033gfB(interfaceC14894gbR); } } c15033gfB.c = this; while (true) { Object obj = this._state; if (!(obj instanceof AbstractC15115ghd)) { if (obj instanceof C15051gfk) { C15051gfk c15051gfk = (C15051gfk) obj; if (c15051gfk.d) { AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = a; while (!atomicReferenceFieldUpdater.compareAndSet(this, obj, c15033gfB)) { if (atomicReferenceFieldUpdater.get(this) != obj) { break; } } return c15033gfB; } gfI gfi = new gfI(); InterfaceC15064gfx c15062gfv = c15051gfk.d ? gfi : new C15062gfv(gfi); AtomicReferenceFieldUpdater atomicReferenceFieldUpdater2 = a; while (!atomicReferenceFieldUpdater2.compareAndSet(this, c15051gfk, c15062gfv) && atomicReferenceFieldUpdater2.get(this) == c15051gfk) { } } else if (obj instanceof InterfaceC15064gfx) { gfI a2 = ((InterfaceC15064gfx) obj).a(); if (a2 != null) { InterfaceC15056gfp interfaceC15056gfp = gfL.d; if (z && (obj instanceof LWm)) { synchronized (obj) { th = (Throwable) ((LWm) obj)._rootCause; if (th == null || ((interfaceC14894gbR instanceof C14996geE) && ((LWm) obj)._isCompleting == 0)) { if (d(obj, a2, c15033gfB)) { if (th == null) { return c15033gfB; } interfaceC15056gfp = c15033gfB; } } C14866gag c14866gag = C14866gag.c; } } else { th = null; } if (th != null) { if (z2) { interfaceC14894gbR.invoke(th); } return interfaceC15056gfp; } if (d(obj, a2, c15033gfB)) { return c15033gfB; } } else { if (obj == null) { throw new NullPointerException("null cannot be cast to non-null type kotlinx.coroutines.JobNode"); } d((gfF) obj); } } else { if (z2) { C15000geK c15000geK = obj instanceof C15000geK ? (C15000geK) obj : null; interfaceC14894gbR.invoke(c15000geK != null ? c15000geK.d : null); } return gfL.d; } } else { ((AbstractC15115ghd) obj).a(this); } } } protected String b() { return "Job was cancelled"; } }