package I1;

import java.io.EOFException;
import kotlin.jvm.internal.l;
import okio.AbstractC0684b;
import okio.C0688f;
import okio.t;
import okio.y;

/* JADX INFO: loaded from: classes2.dex */
public abstract class a {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    private static final byte[] f998a = AbstractC0684b.a("0123456789abcdef");

    public static final byte[] a() {
        return f998a;
    }

    public static final boolean b(y segment, int i2, byte[] bytes, int i3, int i4) {
        l.e(segment, "segment");
        l.e(bytes, "bytes");
        int i5 = segment.f6073c;
        byte[] bArr = segment.f6071a;
        while (i3 < i4) {
            if (i2 == i5) {
                segment = segment.f6076f;
                l.b(segment);
                byte[] bArr2 = segment.f6071a;
                bArr = bArr2;
                i2 = segment.f6072b;
                i5 = segment.f6073c;
            }
            if (bArr[i2] != bytes[i3]) {
                return false;
            }
            i2++;
            i3++;
        }
        return true;
    }

    public static final String c(C0688f readUtf8Line, long j2) throws EOFException {
        l.e(readUtf8Line, "$this$readUtf8Line");
        if (j2 > 0) {
            long j3 = j2 - 1;
            if (readUtf8Line.j(j3) == ((byte) 13)) {
                String strD = readUtf8Line.D(j3);
                readUtf8Line.skip(2L);
                return strD;
            }
        }
        String strD2 = readUtf8Line.D(j2);
        readUtf8Line.skip(1L);
        return strD2;
    }

    /* JADX WARN: Code restructure failed: missing block: B:23:0x005d, code lost:
    
        if (r19 == false) goto L25;
     */
    /* JADX WARN: Code restructure failed: missing block: B:24:0x005f, code lost:
    
        return -2;
     */
    /* JADX WARN: Code restructure failed: missing block: B:25:0x0060, code lost:
    
        return r10;
     */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public static final int d(okio.C0688f r17, okio.t r18, boolean r19) {
        /*
            r0 = r17
            java.lang.String r1 = "$this$selectPrefix"
            kotlin.jvm.internal.l.e(r0, r1)
            java.lang.String r1 = "options"
            r2 = r18
            kotlin.jvm.internal.l.e(r2, r1)
            okio.y r0 = r0.f6021b
            r1 = -2
            r3 = -1
            if (r0 == 0) goto La9
            byte[] r4 = r0.f6071a
            int r5 = r0.f6072b
            int r6 = r0.f6073c
            int[] r2 = r18.e()
            r7 = 0
            r9 = r0
            r10 = r3
            r8 = r7
        L22:
            int r11 = r8 + 1
            r12 = r2[r8]
            int r8 = r8 + 2
            r11 = r2[r11]
            if (r11 == r3) goto L2d
            r10 = r11
        L2d:
            if (r9 != 0) goto L30
            goto L5d
        L30:
            r11 = 0
            if (r12 >= 0) goto L7a
            int r12 = r12 * (-1)
            int r13 = r8 + r12
        L37:
            int r12 = r5 + 1
            r5 = r4[r5]
            r5 = r5 & 255(0xff, float:3.57E-43)
            int r14 = r8 + 1
            r8 = r2[r8]
            if (r5 == r8) goto L44
            return r10
        L44:
            if (r14 != r13) goto L48
            r5 = 1
            goto L49
        L48:
            r5 = r7
        L49:
            if (r12 != r6) goto L6a
            kotlin.jvm.internal.l.b(r9)
            okio.y r4 = r9.f6076f
            kotlin.jvm.internal.l.b(r4)
            int r6 = r4.f6072b
            byte[] r8 = r4.f6071a
            int r9 = r4.f6073c
            if (r4 != r0) goto L64
            if (r5 != 0) goto L61
        L5d:
            if (r19 == 0) goto L60
            return r1
        L60:
            return r10
        L61:
            r4 = r8
            r8 = r11
            goto L6d
        L64:
            r16 = r8
            r8 = r4
            r4 = r16
            goto L6d
        L6a:
            r8 = r9
            r9 = r6
            r6 = r12
        L6d:
            if (r5 == 0) goto L75
            r5 = r2[r14]
            r13 = r6
            r6 = r9
            r9 = r8
            goto L9f
        L75:
            r5 = r6
            r6 = r9
            r9 = r8
            r8 = r14
            goto L37
        L7a:
            int r13 = r5 + 1
            r5 = r4[r5]
            r5 = r5 & 255(0xff, float:3.57E-43)
            int r14 = r8 + r12
        L82:
            if (r8 != r14) goto L85
            return r10
        L85:
            r15 = r2[r8]
            if (r5 != r15) goto La6
            int r8 = r8 + r12
            r5 = r2[r8]
            if (r13 != r6) goto L9f
            okio.y r9 = r9.f6076f
            kotlin.jvm.internal.l.b(r9)
            int r4 = r9.f6072b
            byte[] r6 = r9.f6071a
            int r8 = r9.f6073c
            r13 = r4
            r4 = r6
            r6 = r8
            if (r9 != r0) goto L9f
            r9 = r11
        L9f:
            if (r5 < 0) goto La2
            return r5
        La2:
            int r8 = -r5
            r5 = r13
            goto L22
        La6:
            int r8 = r8 + 1
            goto L82
        La9:
            if (r19 == 0) goto Lac
            goto Lad
        Lac:
            r1 = r3
        Lad:
            return r1
        */
        throw new UnsupportedOperationException("Method not decompiled: I1.a.d(okio.f, okio.t, boolean):int");
    }

    public static /* synthetic */ int e(C0688f c0688f, t tVar, boolean z2, int i2, Object obj) {
        if ((i2 & 2) != 0) {
            z2 = false;
        }
        return d(c0688f, tVar, z2);
    }
}
