package o;

import java.util.Iterator;
import java.util.Map;
import java.util.WeakHashMap;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* loaded from: classes.dex */
public class U30 implements Iterable {
    public R30 l;
    public R30 m;
    public final WeakHashMap n = new WeakHashMap();

    /* renamed from: o, reason: collision with root package name */
    public int f351o = 0;

    public R30 a(Object obj) {
        R30 r30 = this.l;
        while (r30 != null && !r30.l.equals(obj)) {
            r30 = r30.n;
        }
        return r30;
    }

    public Object b(Object obj) {
        R30 r30A = a(obj);
        if (r30A == null) {
            return null;
        }
        this.f351o--;
        WeakHashMap weakHashMap = this.n;
        if (!weakHashMap.isEmpty()) {
            Iterator it = weakHashMap.keySet().iterator();
            while (it.hasNext()) {
                ((T30) it.next()).a(r30A);
            }
        }
        R30 r30 = r30A.f307o;
        if (r30 != null) {
            r30.n = r30A.n;
        } else {
            this.l = r30A.n;
        }
        R30 r302 = r30A.n;
        if (r302 != null) {
            r302.f307o = r30;
        } else {
            this.m = r30;
        }
        r30A.n = null;
        r30A.f307o = null;
        return r30A.m;
    }

    /* JADX WARN: Code restructure failed: missing block: B:24:0x0048, code lost:
    
        if (r3.hasNext() != false) goto L28;
     */
    /* JADX WARN: Code restructure failed: missing block: B:26:0x0050, code lost:
    
        if (((o.Q30) r7).hasNext() != false) goto L28;
     */
    /* JADX WARN: Code restructure failed: missing block: B:27:0x0052, code lost:
    
        return true;
     */
    /* JADX WARN: Code restructure failed: missing block: B:28:0x0053, code lost:
    
        return false;
     */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public final boolean equals(java.lang.Object r7) {
        /*
            r6 = this;
            r0 = 1
            if (r7 != r6) goto L4
            return r0
        L4:
            boolean r1 = r7 instanceof o.U30
            r2 = 0
            if (r1 != 0) goto La
            return r2
        La:
            o.U30 r7 = (o.U30) r7
            int r1 = r6.f351o
            int r3 = r7.f351o
            if (r1 == r3) goto L13
            return r2
        L13:
            java.util.Iterator r1 = r6.iterator()
            java.util.Iterator r7 = r7.iterator()
        L1b:
            r3 = r1
            o.Q30 r3 = (o.Q30) r3
            boolean r4 = r3.hasNext()
            if (r4 == 0) goto L44
            r4 = r7
            o.Q30 r4 = (o.Q30) r4
            boolean r5 = r4.hasNext()
            if (r5 == 0) goto L44
            java.lang.Object r3 = r3.next()
            java.util.Map$Entry r3 = (java.util.Map.Entry) r3
            java.lang.Object r4 = r4.next()
            if (r3 != 0) goto L3b
            if (r4 != 0) goto L43
        L3b:
            if (r3 == 0) goto L1b
            boolean r3 = r3.equals(r4)
            if (r3 != 0) goto L1b
        L43:
            return r2
        L44:
            boolean r1 = r3.hasNext()
            if (r1 != 0) goto L53
            o.Q30 r7 = (o.Q30) r7
            boolean r7 = r7.hasNext()
            if (r7 != 0) goto L53
            return r0
        L53:
            return r2
        */
        throw new UnsupportedOperationException("Method not decompiled: o.U30.equals(java.lang.Object):boolean");
    }

    public final int hashCode() {
        Iterator it = iterator();
        int iHashCode = 0;
        while (true) {
            Q30 q30 = (Q30) it;
            if (!q30.hasNext()) {
                return iHashCode;
            }
            iHashCode += ((Map.Entry) q30.next()).hashCode();
        }
    }

    @Override // java.lang.Iterable
    public final Iterator iterator() {
        Q30 q30 = new Q30(this.l, this.m, 0);
        this.n.put(q30, Boolean.FALSE);
        return q30;
    }

    public final String toString() {
        StringBuilder sb = new StringBuilder("[");
        Iterator it = iterator();
        while (true) {
            Q30 q30 = (Q30) it;
            if (!q30.hasNext()) {
                sb.append("]");
                return sb.toString();
            }
            sb.append(((Map.Entry) q30.next()).toString());
            if (q30.hasNext()) {
                sb.append(", ");
            }
        }
    }
}
