package defpackage;

import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.AtomicReference;

/* JADX INFO: renamed from: ᵬᵯᵼ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes3.dex */
public final class C4087 extends AbstractC5343 {

    /* JADX INFO: renamed from: ˌᵨʠᵫ, reason: contains not printable characters */
    public C2781 f15676;

    /* JADX INFO: renamed from: ᵸˆˁ, reason: contains not printable characters */
    public final int f15677;

    public C4087(C2781 c2781, int i) {
        this.f15676 = c2781;
        this.f15677 = i;
    }

    @Override // defpackage.AbstractC5343
    /* JADX INFO: renamed from: ᵶᵥᵝ */
    public final String mo1685() {
        InterfaceC2559 interfaceC2559;
        C2781 c2781 = this.f15676;
        if (c2781 == null || (interfaceC2559 = (InterfaceC2559) ((RunnableC0648) c2781.f10705).f3035) == null) {
            return null;
        }
        String string = interfaceC2559.toString();
        String strM2864 = AbstractC0793.m2864(new StringBuilder(string.length() + 11), "callable=[", string, "]");
        C0250 c0250 = (C0250) ((AtomicReference) this.f15676.f10706).get();
        if (c0250 == null) {
            return strM2864;
        }
        int length = strM2864.length();
        String string2 = c0250.toString();
        StringBuilder sb = new StringBuilder(string2.length() + length + 9 + 1);
        sb.append(strM2864);
        sb.append(", trial=[");
        sb.append(string2);
        sb.append("]");
        return sb.toString();
    }

    @Override // defpackage.AbstractC5343
    /* JADX INFO: renamed from: ᵷᵺʾᵖ */
    public final void mo1686() {
        AtomicLong atomicLong;
        long j;
        int i;
        int i2;
        boolean z;
        C2781 c2781 = this.f15676;
        this.f15676 = null;
        if (c2781 == null) {
            return;
        }
        AtomicReference atomicReference = (AtomicReference) c2781.f10706;
        do {
            atomicLong = (AtomicLong) c2781.f10704;
            j = atomicLong.get();
            i = (int) j;
            long j2 = j >>> 32;
            if (i == Integer.MIN_VALUE) {
                StringBuilder sb = new StringBuilder(String.valueOf(j).length() + 13);
                sb.append("Refcount is: ");
                sb.append(j);
                throw new AssertionError(sb.toString());
            }
            i2 = (int) j2;
            z = i == -2147483647;
            if (z) {
                i2++;
            }
        } while (!atomicLong.compareAndSet(j, (((long) i2) << 32) | (4294967295L & ((long) (i - 1)))));
        if (z) {
            while (true) {
                C0250 c0250 = (C0250) atomicReference.get();
                if (c0250 != null) {
                    if (c0250.f1830 <= this.f15677) {
                        c0250.cancel(true);
                        while (!atomicReference.compareAndSet(c0250, null)) {
                            if (atomicReference.get() != c0250) {
                                break;
                            }
                        }
                        return;
                    }
                    return;
                }
                return;
            }
        }
    }
}
