what-the-bank/sources/o/AbstractC15053gfm.java

460 lines
16 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package o;
import java.util.Arrays;
import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
/* renamed from: o.gfm, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public abstract class AbstractC15053gfm extends AbstractC15059gfs implements InterfaceC15043gfc {
private static final AtomicReferenceFieldUpdater j = AtomicReferenceFieldUpdater.newUpdater(AbstractC15053gfm.class, Object.class, "_queue");
private static final AtomicReferenceFieldUpdater a = AtomicReferenceFieldUpdater.newUpdater(AbstractC15053gfm.class, Object.class, "_delayed");
private volatile Object _queue = null;
private volatile Object _delayed = null;
private volatile int _isCompleted = 0;
/* JADX INFO: Access modifiers changed from: protected */
@Override // o.AbstractC15057gfq
public final boolean i() {
C15119ghh c15119ghh;
ggE<AbstractC15050gfj<?>> gge = this.e;
if (!(gge == null || gge.a == gge.e)) {
return false;
}
Sts sts = (Sts) this._delayed;
if (sts != null && sts._size != 0) {
return false;
}
Object obj = this._queue;
if (obj == null) {
return true;
}
if (obj instanceof ggX) {
long j2 = ((ggX) obj)._state;
if (((int) (1073741823 & j2)) == ((int) ((j2 & 1152921503533105152L) >> 30))) {
return true;
}
} else {
c15119ghh = C15063gfw.a;
if (obj == c15119ghh) {
return true;
}
}
return false;
}
@Override // o.AbstractC15057gfq
protected final long f() {
HBt c;
C15119ghh c15119ghh;
if (super.f() == 0) {
return 0L;
}
Object obj = this._queue;
if (obj != null) {
if (obj instanceof ggX) {
long j2 = ((ggX) obj)._state;
if (((int) (1073741823 & j2)) != ((int) ((j2 & 1152921503533105152L) >> 30))) {
return 0L;
}
} else {
c15119ghh = C15063gfw.a;
return obj == c15119ghh ? Long.MAX_VALUE : 0L;
}
}
Sts sts = (Sts) this._delayed;
if (sts == null || (c = sts.c()) == null) {
return Long.MAX_VALUE;
}
long nanoTime = c.c - System.nanoTime();
if (nanoTime < 0) {
return 0L;
}
return nanoTime;
}
/* JADX WARN: Code restructure failed: missing block: B:22:0x0063, code lost:
if (j() <= 0) goto L50;
*/
/* JADX WARN: Code restructure failed: missing block: B:24:0x0065, code lost:
r0 = java.lang.System.nanoTime();
*/
/* JADX WARN: Code restructure failed: missing block: B:25:0x0069, code lost:
r2 = (o.AbstractC15053gfm.Sts) r5._delayed;
*/
/* JADX WARN: Code restructure failed: missing block: B:26:0x006d, code lost:
if (r2 == null) goto L52;
*/
/* JADX WARN: Code restructure failed: missing block: B:27:0x006f, code lost:
r2 = r2.e();
*/
/* JADX WARN: Code restructure failed: missing block: B:28:0x0075, code lost:
if (r2 == null) goto L51;
*/
/* JADX WARN: Code restructure failed: missing block: B:29:0x0077, code lost:
e(r0, r2);
*/
/* JADX WARN: Code restructure failed: missing block: B:31:0x007b, code lost:
return;
*/
/* JADX WARN: Code restructure failed: missing block: B:34:?, code lost:
return;
*/
@Override // o.AbstractC15057gfq
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public void e() {
/*
r5 = this;
o.gfT r0 = o.C15039gfT.e
o.C15039gfT.b()
r0 = 1
r5._isCompleted = r0
o.C15045gfe.b()
Lb:
java.lang.Object r1 = r5._queue
if (r1 != 0) goto L24
java.util.concurrent.atomic.AtomicReferenceFieldUpdater r2 = o.AbstractC15053gfm.j
o.ghh r3 = o.C15063gfw.b()
L15:
r1 = 0
boolean r1 = r2.compareAndSet(r5, r1, r3)
if (r1 == 0) goto L1d
goto L5b
L1d:
java.lang.Object r1 = r2.get(r5)
if (r1 == 0) goto L15
goto Lb
L24:
boolean r2 = r1 instanceof o.ggX
if (r2 == 0) goto L2e
o.ggX r1 = (o.ggX) r1
r1.e()
goto L5b
L2e:
o.ghh r2 = o.C15063gfw.b()
if (r1 == r2) goto L5b
o.ggX r2 = new o.ggX
r3 = 8
r2.<init>(r3, r0)
if (r1 == 0) goto L53
r3 = r1
java.lang.Runnable r3 = (java.lang.Runnable) r3
r2.d(r3)
java.util.concurrent.atomic.AtomicReferenceFieldUpdater r3 = o.AbstractC15053gfm.j
L45:
boolean r4 = r3.compareAndSet(r5, r1, r2)
if (r4 == 0) goto L4c
goto L5b
L4c:
java.lang.Object r4 = r3.get(r5)
if (r4 == r1) goto L45
goto Lb
L53:
java.lang.NullPointerException r0 = new java.lang.NullPointerException
java.lang.String r1 = "null cannot be cast to non-null type java.lang.Runnable{ kotlinx.coroutines.RunnableKt.Runnable }"
r0.<init>(r1)
throw r0
L5b:
long r0 = r5.j()
r2 = 0
int r0 = (r0 > r2 ? 1 : (r0 == r2 ? 0 : -1))
if (r0 <= 0) goto L5b
long r0 = java.lang.System.nanoTime()
L69:
java.lang.Object r2 = r5._delayed
o.gfm$Sts r2 = (o.AbstractC15053gfm.Sts) r2
if (r2 == 0) goto L7b
o.ghl r2 = r2.e()
o.gfm$HBt r2 = (o.AbstractC15053gfm.HBt) r2
if (r2 == 0) goto L7b
r5.e(r0, r2)
goto L69
L7b:
return
*/
throw new UnsupportedOperationException("Method not decompiled: o.AbstractC15053gfm.e():void");
}
@Override // o.AbstractC15057gfq
public final long j() {
C15119ghh c15119ghh;
HBt b;
if (h()) {
return 0L;
}
Sts sts = (Sts) this._delayed;
Runnable runnable = null;
if (sts != null && sts._size != 0) {
long nanoTime = System.nanoTime();
do {
Sts sts2 = sts;
synchronized (sts2) {
Object[] objArr = sts2.e;
Object obj = objArr != null ? objArr[0] : null;
if (obj == null) {
b = null;
} else {
HBt hBt = (HBt) obj;
b = (nanoTime - hBt.c < 0 || !a(hBt)) ? null : sts2.b();
}
}
} while (b != null);
}
while (true) {
Object obj2 = this._queue;
if (obj2 == null) {
break;
}
if (!(obj2 instanceof ggX)) {
c15119ghh = C15063gfw.a;
if (obj2 == c15119ghh) {
break;
}
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = j;
while (!atomicReferenceFieldUpdater.compareAndSet(this, obj2, null)) {
if (atomicReferenceFieldUpdater.get(this) != obj2) {
break;
}
}
if (obj2 != null) {
runnable = (Runnable) obj2;
} else {
throw new NullPointerException("null cannot be cast to non-null type java.lang.Runnable{ kotlinx.coroutines.RunnableKt.Runnable }");
}
} else if (obj2 != null) {
ggX ggx = (ggX) obj2;
Object a2 = ggx.a();
if (a2 != ggX.e) {
runnable = (Runnable) a2;
break;
}
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater2 = j;
ggX c = ggx.c(ggx.b());
while (!atomicReferenceFieldUpdater2.compareAndSet(this, obj2, c) && atomicReferenceFieldUpdater2.get(this) == obj2) {
}
} else {
throw new NullPointerException("null cannot be cast to non-null type kotlinx.coroutines.internal.LockFreeTaskQueueCore<java.lang.Runnable{ kotlinx.coroutines.RunnableKt.Runnable }>{ kotlinx.coroutines.EventLoop_commonKt.Queue<java.lang.Runnable{ kotlinx.coroutines.RunnableKt.Runnable }> }");
}
}
if (runnable != null) {
runnable.run();
return 0L;
}
return f();
}
@Override // o.AbstractC15004geU
public final void d(InterfaceC14912gbn interfaceC14912gbn, Runnable runnable) {
e(runnable);
}
public void e(Runnable runnable) {
if (a(runnable)) {
l();
} else {
RunnableC15044gfd.a.e(runnable);
}
}
/* renamed from: o.gfm$HBt */
/* loaded from: classes.dex */
public static abstract class HBt implements Runnable, Comparable<HBt>, InterfaceC15056gfp, InterfaceC15123ghl {
private volatile Object _heap;
public long c;
/* JADX WARN: Type inference failed for: r13v2, types: [T extends o.ghl & java.lang.Comparable<? super T>[], o.ghl[]] */
/* JADX WARN: Type inference failed for: r13v7, types: [T extends o.ghl & java.lang.Comparable<? super T>[], o.ghl[]] */
public final int e(long j, Sts sts, AbstractC15053gfm abstractC15053gfm) {
C15119ghh c15119ghh;
Object[] objArr;
synchronized (this) {
Object obj = this._heap;
c15119ghh = C15063gfw.b;
if (obj == c15119ghh) {
return 2;
}
Sts sts2 = sts;
synchronized (sts2) {
Object[] objArr2 = sts2.e;
HBt hBt = (HBt) (objArr2 != null ? objArr2[0] : null);
if (abstractC15053gfm._isCompleted) {
return 1;
}
if (hBt == null) {
sts.b = j;
} else {
long j2 = hBt.c;
if (j2 - j < 0) {
j = j2;
}
if (j - sts.b > 0) {
sts.b = j;
}
}
if (this.c - sts.b < 0) {
this.c = sts.b;
}
HBt hBt2 = this;
C15045gfe.b();
Object[] objArr3 = sts2.e;
if (objArr3 == null) {
?? r13 = new InterfaceC15123ghl[4];
sts2.e = r13;
objArr = r13;
} else {
int i = sts2._size;
int length = objArr3.length;
objArr = objArr3;
if (i >= length) {
Object[] copyOf = Arrays.copyOf(objArr3, sts2._size << 1);
C14957gcv.c(copyOf, "");
?? r132 = (InterfaceC15123ghl[]) copyOf;
sts2.e = r132;
objArr = r132;
}
}
int i2 = sts2._size;
sts2._size = i2 + 1;
objArr[i2] = hBt2;
while (i2 > 0) {
Object[] objArr4 = sts2.e;
C14957gcv.e(objArr4);
int i3 = (i2 - 1) / 2;
Object obj2 = objArr4[i3];
C14957gcv.e(obj2);
Object obj3 = objArr4[i2];
C14957gcv.e(obj3);
if (((Comparable) obj2).compareTo(obj3) <= 0) {
break;
}
sts2.d(i2, i3);
i2 = i3;
}
return 0;
}
}
}
public String toString() {
StringBuilder sb = new StringBuilder("Delayed[nanos=");
sb.append(this.c);
sb.append(']');
return sb.toString();
}
}
/* renamed from: o.gfm$Sts */
/* loaded from: classes.dex */
public static final class Sts extends C15122ghk<HBt> {
public long b;
public Sts(long j) {
this.b = j;
}
}
private final boolean a(Runnable runnable) {
C15119ghh c15119ghh;
while (true) {
Object obj = this._queue;
if (this._isCompleted != 0) {
return false;
}
if (obj == null) {
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = j;
while (!atomicReferenceFieldUpdater.compareAndSet(this, null, runnable)) {
if (atomicReferenceFieldUpdater.get(this) != null) {
break;
}
}
return true;
}
if (!(obj instanceof ggX)) {
c15119ghh = C15063gfw.a;
if (obj == c15119ghh) {
return false;
}
ggX ggx = new ggX(8, true);
if (obj != null) {
ggx.d((Runnable) obj);
ggx.d(runnable);
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater2 = j;
while (!atomicReferenceFieldUpdater2.compareAndSet(this, obj, ggx)) {
if (atomicReferenceFieldUpdater2.get(this) != obj) {
break;
}
}
return true;
}
throw new NullPointerException("null cannot be cast to non-null type java.lang.Runnable{ kotlinx.coroutines.RunnableKt.Runnable }");
}
if (obj != null) {
ggX ggx2 = (ggX) obj;
int d = ggx2.d(runnable);
if (d == 0) {
return true;
}
if (d == 1) {
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater3 = j;
ggX c = ggx2.c(ggx2.b());
while (!atomicReferenceFieldUpdater3.compareAndSet(this, obj, c) && atomicReferenceFieldUpdater3.get(this) == obj) {
}
} else if (d == 2) {
return false;
}
} else {
throw new NullPointerException("null cannot be cast to non-null type kotlinx.coroutines.internal.LockFreeTaskQueueCore<java.lang.Runnable{ kotlinx.coroutines.RunnableKt.Runnable }>{ kotlinx.coroutines.EventLoop_commonKt.Queue<java.lang.Runnable{ kotlinx.coroutines.RunnableKt.Runnable }> }");
}
}
}
public final void b(long j2, HBt hBt) {
int e;
if (this._isCompleted != 0) {
e = 1;
} else {
Sts sts = (Sts) this._delayed;
if (sts == null) {
AtomicReferenceFieldUpdater atomicReferenceFieldUpdater = a;
Sts sts2 = new Sts(j2);
while (!atomicReferenceFieldUpdater.compareAndSet(this, null, sts2) && atomicReferenceFieldUpdater.get(this) == null) {
}
Object obj = this._delayed;
C14957gcv.e(obj);
sts = (Sts) obj;
}
e = hBt.e(j2, sts, this);
}
if (e == 0) {
Sts sts3 = (Sts) this._delayed;
if ((sts3 != null ? sts3.c() : null) == hBt) {
l();
return;
}
return;
}
if (e == 1) {
e(j2, hBt);
} else if (e != 2) {
throw new IllegalStateException("unexpected result".toString());
}
}
/* JADX INFO: Access modifiers changed from: protected */
public final void g() {
this._queue = null;
this._delayed = null;
}
}