package o; import java.util.Arrays; import java.util.concurrent.locks.ReentrantLock; /* renamed from: o.ggd, reason: case insensitive filesystem */ /* loaded from: classes6.dex */ public final class C15076ggd extends gfZ { private final ReentrantLock a; private final int b; private Object[] c; private int e; private final EnumC15077gge f; private volatile int size; public C15076ggd(int i, EnumC15077gge enumC15077gge) { super(null); this.b = 10; this.f = enumC15077gge; this.a = new ReentrantLock(); int min = Math.min(10, 8); Object[] objArr = new Object[min]; C15119ghh c15119ghh = C15074ggb.c; C14957gcv.e(objArr, ""); Arrays.fill(objArr, 0, min, c15119ghh); this.c = objArr; this.size = 0; } @Override // o.AbstractC15079ggg protected final String a() { StringBuilder sb = new StringBuilder("(buffer:capacity="); sb.append(this.b); sb.append(",size="); sb.append(this.size); sb.append(')'); return sb.toString(); } /* JADX WARN: Code restructure failed: missing block: B:15:0x0043, code lost: if (r1 == 0) goto L26; */ /* JADX WARN: Code restructure failed: missing block: B:16:0x0045, code lost: r2 = d(); */ /* JADX WARN: Code restructure failed: missing block: B:17:0x0049, code lost: if (r2 == null) goto L55; */ /* JADX WARN: Code restructure failed: missing block: B:19:0x004d, code lost: if ((r2 instanceof o.C15085ggm) == false) goto L33; */ /* JADX WARN: Code restructure failed: missing block: B:20:0x0055, code lost: o.C14957gcv.e(r2); */ /* JADX WARN: Code restructure failed: missing block: B:21:0x005c, code lost: if (r2.b(r10) == null) goto L58; */ /* JADX WARN: Code restructure failed: missing block: B:23:0x005e, code lost: o.C15045gfe.b(); r9.size = r1; r1 = o.C14866gag.c; */ /* JADX WARN: Code restructure failed: missing block: B:24:0x0065, code lost: r0.unlock(); r2.c(r10); */ /* JADX WARN: Code restructure failed: missing block: B:25:0x006f, code lost: return r2.c(); */ /* JADX WARN: Code restructure failed: missing block: B:28:0x004f, code lost: r9.size = r1; */ /* JADX WARN: Code restructure failed: missing block: B:30:0x0054, code lost: return r2; */ /* JADX WARN: Code restructure failed: missing block: B:32:0x0070, code lost: r2 = r9.b; */ /* JADX WARN: Code restructure failed: missing block: B:33:0x0072, code lost: if (r1 >= r2) goto L47; */ /* JADX WARN: Code restructure failed: missing block: B:34:0x0074, code lost: r3 = r9.c; */ /* JADX WARN: Code restructure failed: missing block: B:35:0x0077, code lost: if (r1 < r3.length) goto L46; */ /* JADX WARN: Code restructure failed: missing block: B:36:0x0079, code lost: r2 = java.lang.Math.min(r3.length << 1, r2); r3 = new java.lang.Object[r2]; r5 = 0; */ /* JADX WARN: Code restructure failed: missing block: B:37:0x0083, code lost: if (r5 >= r1) goto L59; */ /* JADX WARN: Code restructure failed: missing block: B:38:0x0085, code lost: r6 = r9.c; r3[r5] = r6[(r9.e + r5) % r6.length]; r5 = r5 + 1; */ /* JADX WARN: Code restructure failed: missing block: B:40:0x0093, code lost: r5 = o.C15074ggb.c; o.C14957gcv.e(r3, ""); java.util.Arrays.fill(r3, r1, r2, r5); r9.c = r3; r9.e = 0; */ /* JADX WARN: Code restructure failed: missing block: B:41:0x00a1, code lost: r2 = r9.c; r2[(r9.e + r1) % r2.length] = r10; */ /* JADX WARN: Code restructure failed: missing block: B:44:0x00c6, code lost: return o.C15074ggb.e; */ /* JADX WARN: Code restructure failed: missing block: B:45:0x00ab, code lost: o.C15045gfe.b(); r2 = r9.c; r5 = r9.e; r2[r5 % r2.length] = null; r2[(r1 + r5) % r2.length] = r10; r9.e = (r5 + 1) % r2.length; */ /* JADX WARN: Removed duplicated region for block: B:13:0x003f A[DONT_GENERATE] */ /* JADX WARN: Removed duplicated region for block: B:15:0x0043 */ @Override // o.AbstractC15079ggg /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ protected final java.lang.Object b(E r10) { /* Method dump skipped, instructions count: 204 To view this dump add '--comments-level debug' option */ throw new UnsupportedOperationException("Method not decompiled: o.C15076ggd.b(java.lang.Object):java.lang.Object"); } @Override // o.gfZ protected final Object c() { ReentrantLock reentrantLock = this.a; reentrantLock.lock(); try { int i = this.size; if (i == 0) { Object h = h(); if (h == null) { h = C15074ggb.d; } return h; } Object[] objArr = this.c; int i2 = this.e; Object obj = objArr[i2]; AbstractC15087ggo abstractC15087ggo = null; objArr[i2] = null; this.size = i - 1; Object obj2 = C15074ggb.d; boolean z = false; if (i == this.b) { while (true) { AbstractC15087ggo f = f(); if (f == null) { break; } C14957gcv.e(f); if (f.e() != null) { C15045gfe.b(); obj2 = f.a(); abstractC15087ggo = f; z = true; break; } abstractC15087ggo = f; } } if (obj2 != C15074ggb.d && !(obj2 instanceof C15085ggm)) { this.size = i; Object[] objArr2 = this.c; objArr2[(this.e + i) % objArr2.length] = obj2; } this.e = (this.e + 1) % this.c.length; C14866gag c14866gag = C14866gag.c; if (z) { C14957gcv.e(abstractC15087ggo); } return obj; } finally { reentrantLock.unlock(); } } /* JADX INFO: Access modifiers changed from: protected */ @Override // o.gfZ public final boolean a(AbstractC15082ggj abstractC15082ggj) { ReentrantLock reentrantLock = this.a; reentrantLock.lock(); try { return super.a(abstractC15082ggj); } finally { reentrantLock.unlock(); } } /* renamed from: o.ggd$IeS */ /* loaded from: classes6.dex */ public final /* synthetic */ class IeS { public static final int[] c; static { int[] iArr = new int[EnumC15077gge.values().length]; iArr[EnumC15077gge.SUSPEND.ordinal()] = 1; iArr[EnumC15077gge.DROP_LATEST.ordinal()] = 2; iArr[EnumC15077gge.DROP_OLDEST.ordinal()] = 3; c = iArr; } } @Override // o.gfZ protected final boolean e() { return this.size == 0; } }