package defpackage;

import kotlinx.coroutines.DispatchException;

/* JADX INFO: renamed from: ᵭˇᵵˀ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes3.dex */
public final class C4131 extends C0349 {

    /* JADX INFO: renamed from: ˊᵾʽʼ, reason: contains not printable characters */
    public final int f15791;

    public C4131(int i, int i2) {
        super(i);
        this.f15791 = i2;
        if (i2 == 1) {
            ᵷᵝˎ.ˌᴵ("This implementation does not support suspension for senders, use ", AbstractC3463.m7898(C0349.class).m9408(), " instead");
            throw null;
        }
        if (i >= 1) {
            return;
        }
        ᵕᵩʽᵲ.ᵱᵽʡᵚ(AbstractC0793.m2876(i, "Buffered channel capacity must be at least 1, but ", " was specified"));
        throw null;
    }

    /* JADX WARN: Code restructure failed: missing block: B:49:0x00b3, code lost:
    
        return r8;
     */
    /* JADX INFO: renamed from: ᵞᵛᵘ, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final Object m9035(Object obj, boolean z) throws DispatchException {
        C5063 c5063 = C5063.f19112;
        if (this.f15791 == 3) {
            Object objMo1661 = super.mo1661(obj);
            return (!(objMo1661 instanceof C0566) || (objMo1661 instanceof C2502)) ? objMo1661 : c5063;
        }
        Object obj2 = AbstractC4752.f18086;
        C2552 c2552 = (C2552) C0349.f2124.get(this);
        while (true) {
            long andIncrement = C0349.f2120.getAndIncrement(this);
            long j = 1152921504606846975L & andIncrement;
            boolean zM1658 = m1658(false, andIncrement);
            int i = AbstractC4752.f18070;
            long j2 = i;
            long j3 = j / j2;
            int i2 = (int) (j % j2);
            if (c2552.f17947 != j3) {
                C2552 c2552M1632 = m1632(j3, c2552);
                if (c2552M1632 != null) {
                    c2552 = c2552M1632;
                } else if (zM1658) {
                    return new C2502(m1634());
                }
            }
            int iM1624 = C0349.m1624(this, c2552, i2, obj, j, obj2, zM1658);
            if (iM1624 == 0) {
                c2552.m10590();
                return c5063;
            }
            if (iM1624 == 1) {
                break;
            }
            if (iM1624 != 2) {
                if (iM1624 == 3) {
                    ᵕᵩʽᵲ.ᵪᵹᵥᵻ("unexpected");
                    return null;
                }
                if (iM1624 == 4) {
                    if (j < C0349.f2119.get(this)) {
                        c2552.m10590();
                    }
                    return new C2502(m1634());
                }
                if (iM1624 == 5) {
                    c2552.m10590();
                }
            } else {
                if (zM1658) {
                    c2552.m9850();
                    return new C2502(m1634());
                }
                InterfaceC2973 interfaceC2973 = obj2 instanceof InterfaceC2973 ? (InterfaceC2973) obj2 : null;
                if (interfaceC2973 != null) {
                    interfaceC2973.mo3792(c2552, i2 + i);
                }
                m1637((c2552.f17947 * j2) + ((long) i2));
            }
        }
    }

    @Override // defpackage.C0349
    /* JADX INFO: renamed from: ᵸˆˁ */
    public final boolean mo1660() {
        return this.f15791 == 2;
    }

    @Override // defpackage.C0349, defpackage.InterfaceC3561
    /* JADX INFO: renamed from: ᵻʽᵯ */
    public final Object mo1661(Object obj) {
        return m9035(obj, false);
    }

    @Override // defpackage.C0349, defpackage.InterfaceC3561
    /* JADX INFO: renamed from: ᵻˈᵦʼ */
    public final Object mo1662(InterfaceC2643 interfaceC2643, Object obj) throws Throwable {
        if (m9035(obj, true) instanceof C2502) {
            throw m1634();
        }
        return C5063.f19112;
    }
}
