package o; /* loaded from: classes.dex */ public final class ggS extends AbstractC15004geU implements Runnable, InterfaceC15043gfc { private final AbstractC15004geU a; private final int b; private final InterfaceC15043gfc e; private final ggZ i; private final Object j; private volatile int runningWorkers; /* JADX WARN: Multi-variable type inference failed */ public ggS(AbstractC15004geU abstractC15004geU, int i) { this.a = abstractC15004geU; this.b = i; InterfaceC15043gfc interfaceC15043gfc = abstractC15004geU instanceof InterfaceC15043gfc ? (InterfaceC15043gfc) abstractC15004geU : null; this.e = interfaceC15043gfc == null ? C15042gfb.b() : interfaceC15043gfc; this.i = new ggZ<>(); this.j = new Object(); } @Override // o.AbstractC15004geU public final AbstractC15004geU c(int i) { if (i > 0) { if (i >= this.b) { return this; } return super.c(i); } throw new IllegalArgumentException("Expected positive parallelism level, but got ".concat(String.valueOf(i)).toString()); } /* JADX WARN: Code restructure failed: missing block: B:22:0x0031, code lost: r0 = r6.j; */ /* JADX WARN: Code restructure failed: missing block: B:23:0x0033, code lost: monitor-enter(r0); */ /* JADX WARN: Code restructure failed: missing block: B:25:0x0034, code lost: r6.runningWorkers--; r1 = ((o.ggX) r6.i._cur)._state; */ /* JADX WARN: Code restructure failed: missing block: B:27:0x0056, code lost: if (((((int) ((r1 & 1152921503533105152L) >> 30)) - ((int) (1073741823 & r1))) & 1073741823) != 0) goto L22; */ /* JADX WARN: Code restructure failed: missing block: B:28:0x005a, code lost: r6.runningWorkers++; r1 = o.C14866gag.c; */ /* JADX WARN: Code restructure failed: missing block: B:31:0x0058, code lost: monitor-exit(r0); */ /* JADX WARN: Code restructure failed: missing block: B:32:0x0059, code lost: return; */ @Override // java.lang.Runnable /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ public final void run() { /* r6 = this; L0: r0 = 0 L1: o.ggZ r1 = r6.i java.lang.Object r1 = r1.c() java.lang.Runnable r1 = (java.lang.Runnable) r1 if (r1 == 0) goto L31 r1.run() // Catch: java.lang.Throwable -> Lf goto L17 Lf: r1 = move-exception o.gbj r2 = o.C14908gbj.e o.gbn r2 = (o.InterfaceC14912gbn) r2 o.geO.b(r2, r1) L17: int r0 = r0 + 1 r1 = 16 if (r0 < r1) goto L1 o.geU r1 = r6.a r2 = r6 o.gbn r2 = (o.InterfaceC14912gbn) r2 boolean r1 = r1.c() if (r1 == 0) goto L1 o.geU r0 = r6.a r1 = r6 java.lang.Runnable r1 = (java.lang.Runnable) r1 r0.d(r2, r1) return L31: java.lang.Object r0 = r6.j monitor-enter(r0) int r1 = r6.runningWorkers // Catch: java.lang.Throwable -> L64 int r1 = r1 + (-1) r6.runningWorkers = r1 // Catch: java.lang.Throwable -> L64 o.ggZ r1 = r6.i // Catch: java.lang.Throwable -> L64 java.lang.Object r1 = r1._cur // Catch: java.lang.Throwable -> L64 o.ggX r1 = (o.ggX) r1 // Catch: java.lang.Throwable -> L64 long r1 = r1._state // Catch: java.lang.Throwable -> L64 r3 = 1073741823(0x3fffffff, double:5.304989472E-315) long r3 = r3 & r1 int r3 = (int) r3 r4 = 1152921503533105152(0xfffffffc0000000, double:1.2882296003504729E-231) long r1 = r1 & r4 r4 = 30 long r1 = r1 >> r4 int r1 = (int) r1 int r1 = r1 - r3 r2 = 1073741823(0x3fffffff, float:1.9999999) r1 = r1 & r2 if (r1 != 0) goto L5a monitor-exit(r0) return L5a: int r1 = r6.runningWorkers // Catch: java.lang.Throwable -> L64 int r1 = r1 + 1 r6.runningWorkers = r1 // Catch: java.lang.Throwable -> L64 o.gag r1 = o.C14866gag.c // Catch: java.lang.Throwable -> L64 monitor-exit(r0) goto L0 L64: r1 = move-exception monitor-exit(r0) throw r1 */ throw new UnsupportedOperationException("Method not decompiled: o.ggS.run():void"); } @Override // o.AbstractC15004geU public final void d(InterfaceC14912gbn interfaceC14912gbn, Runnable runnable) { this.i.e(runnable); if (this.runningWorkers < this.b && b()) { this.a.d(this, this); } } private final boolean b() { synchronized (this.j) { if (this.runningWorkers >= this.b) { return false; } this.runningWorkers++; return true; } } }