package o; import com.google.zxing.FormatException; import com.google.zxing.NotFoundException; import java.util.Map; /* loaded from: classes2.dex */ public final class Bwv extends xue { private int e = -1; private static final int[] a = {6, 8, 10, 12, 14}; private static final int[] c = {1, 1, 1, 1}; private static final int[][] b = {new int[]{1, 1, 2}, new int[]{1, 1, 3}}; private static final int[][] d = {new int[]{1, 1, 2, 2, 1}, new int[]{2, 1, 1, 1, 2}, new int[]{1, 2, 1, 1, 2}, new int[]{2, 2, 1, 1, 1}, new int[]{1, 1, 2, 1, 2}, new int[]{2, 1, 2, 1, 1}, new int[]{1, 2, 2, 1, 1}, new int[]{1, 1, 1, 2, 2}, new int[]{2, 1, 1, 2, 1}, new int[]{1, 2, 1, 2, 1}, new int[]{1, 1, 3, 3, 1}, new int[]{3, 1, 1, 1, 3}, new int[]{1, 3, 1, 1, 3}, new int[]{3, 3, 1, 1, 1}, new int[]{1, 1, 3, 1, 3}, new int[]{3, 1, 3, 1, 1}, new int[]{1, 3, 3, 1, 1}, new int[]{1, 1, 1, 3, 3}, new int[]{3, 1, 1, 3, 1}, new int[]{1, 3, 1, 3, 1}}; /* JADX WARN: Code restructure failed: missing block: B:10:0x0021, code lost: return; */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ private void d(o.C17416wdP r5, int r6) throws com.google.zxing.NotFoundException { /* r4 = this; int r0 = r4.e int r0 = r0 * 10 int r0 = java.lang.Math.min(r0, r6) L8: int r6 = r6 + (-1) if (r0 <= 0) goto L1f if (r6 < 0) goto L1f int[] r1 = r5.a int r2 = r6 / 32 r1 = r1[r2] r2 = r6 & 31 r3 = 1 int r2 = r3 << r2 r1 = r1 & r2 if (r1 != 0) goto L1f int r0 = r0 + (-1) goto L8 L1f: if (r0 != 0) goto L22 return L22: com.google.zxing.NotFoundException r5 = com.google.zxing.NotFoundException.b() throw r5 */ throw new UnsupportedOperationException("Method not decompiled: o.Bwv.d(o.wdP, int):void"); } private int[] d(C17416wdP c17416wdP) throws NotFoundException { int[] d2; c17416wdP.c(); try { int i = c17416wdP.d; int a2 = c17416wdP.a(0); if (a2 != i) { try { d2 = d(c17416wdP, a2, b[0]); } catch (NotFoundException unused) { d2 = d(c17416wdP, a2, b[1]); } d(c17416wdP, d2[0]); int i2 = d2[0]; d2[0] = c17416wdP.d - d2[1]; d2[1] = c17416wdP.d - i2; return d2; } throw NotFoundException.b(); } finally { c17416wdP.c(); } } private static int[] d(C17416wdP c17416wdP, int i, int[] iArr) throws NotFoundException { int length = iArr.length; int[] iArr2 = new int[length]; int i2 = c17416wdP.d; int i3 = i; boolean z = false; int i4 = 0; while (i < i2) { if (((c17416wdP.a[i / 32] & (1 << (i & 31))) != 0) != z) { iArr2[i4] = iArr2[i4] + 1; } else { if (i4 != length - 1) { i4++; } else { if (b(iArr2, iArr, 0.5f) < 0.38f) { return new int[]{i3, i}; } i3 += iArr2[0] + iArr2[1]; int i5 = i4 - 1; System.arraycopy(iArr2, 2, iArr2, 0, i5); iArr2[i5] = 0; iArr2[i4] = 0; i4--; } iArr2[i4] = 1; z = !z; } i++; } throw NotFoundException.b(); } private static int b(int[] iArr) throws NotFoundException { int length = d.length; float f = 0.38f; int i = -1; for (int i2 = 0; i2 < length; i2++) { float b2 = b(iArr, d[i2], 0.5f); if (b2 < f) { i = i2; f = b2; } else if (b2 == f) { i = -1; } } if (i >= 0) { return i % 10; } throw NotFoundException.b(); } @Override // o.xue public final WFF d(int i, C17416wdP c17416wdP, Map map) throws FormatException, NotFoundException { boolean z; int i2 = c17416wdP.d; int a2 = c17416wdP.a(0); if (a2 != i2) { int[] d2 = d(c17416wdP, a2, c); int i3 = d2[1]; int i4 = d2[0]; this.e = (i3 - i4) / 4; d(c17416wdP, i4); int[] d3 = d(c17416wdP); StringBuilder sb = new StringBuilder(20); int i5 = d2[1]; int i6 = d3[0]; int[] iArr = new int[10]; int[] iArr2 = new int[5]; int[] iArr3 = new int[5]; while (i5 < i6) { b(c17416wdP, i5, iArr); for (int i7 = 0; i7 < 5; i7++) { int i8 = i7 << 1; iArr2[i7] = iArr[i8]; iArr3[i7] = iArr[i8 + 1]; } sb.append((char) (b(iArr2) + 48)); sb.append((char) (b(iArr3) + 48)); for (int i9 = 0; i9 < 10; i9++) { i5 += iArr[i9]; } } String obj = sb.toString(); int[] iArr4 = map != null ? (int[]) map.get(CGg.ALLOWED_LENGTHS) : null; if (iArr4 == null) { iArr4 = a; } int length = obj.length(); int length2 = iArr4.length; int i10 = 0; int i11 = 0; while (true) { if (i10 >= length2) { z = false; break; } int i12 = iArr4[i10]; if (length == i12) { z = true; break; } if (i12 > i11) { i11 = i12; } i10++; } if ((z || length <= i11) && !z) { throw FormatException.c(); } float f = d2[1]; float f2 = i; WFF wff = new WFF(obj, null, new qCz[]{new qCz(f, f2), new qCz(d3[0], f2)}, PTS.ITF); wff.b(MoF.SYMBOLOGY_IDENTIFIER, "]I0"); return wff; } throw NotFoundException.b(); } }