package l.c0;

import j.p0.d.r;
import java.io.EOFException;
import l.f;
import l.q;

/* JADX INFO: compiled from: Buffer.kt */
/* JADX INFO: loaded from: classes.dex */
public final class a {
    private static final byte[] a = l.b.a("0123456789abcdef");

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

    public static final String b(f fVar, long j2) throws EOFException {
        r.g(fVar, "$this$readUtf8Line");
        if (j2 > 0) {
            long j3 = j2 - 1;
            if (fVar.r(j3) == ((byte) 13)) {
                String strH = fVar.H(j3);
                fVar.k(2L);
                return strH;
            }
        }
        String strH2 = fVar.H(j2);
        fVar.k(1L);
        return strH2;
    }

    /* JADX WARN: Code restructure failed: missing block: B:26:0x005b, code lost:
    
        if (r19 == false) goto L28;
     */
    /* JADX WARN: Code restructure failed: missing block: B:27:0x005d, code lost:
    
        return -2;
     */
    /* JADX WARN: Code restructure failed: missing block: B:28:0x005e, 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 c(l.f r17, l.q r18, boolean r19) {
        /*
            r0 = r17
            java.lang.String r1 = "$this$selectPrefix"
            j.p0.d.r.g(r0, r1)
            java.lang.String r1 = "options"
            r2 = r18
            j.p0.d.r.g(r2, r1)
            l.v r0 = r0.b
            r1 = -2
            r3 = -1
            if (r0 == 0) goto Lb6
            byte[] r4 = r0.a
            int r5 = r0.b
            int r6 = r0.c
            int[] r2 = r18.f()
            r7 = 0
            r9 = r0
            r10 = r3
            r8 = r7
        L22:
            int r11 = r8 + 1
            r8 = r2[r8]
            int r12 = r11 + 1
            r11 = r2[r11]
            if (r11 == r3) goto L2d
            r10 = r11
        L2d:
            if (r9 != 0) goto L30
            goto L5b
        L30:
            r11 = 0
            if (r8 >= 0) goto L83
            int r8 = r8 * (-1)
            int r13 = r12 + r8
        L37:
            int r8 = r5 + 1
            r5 = r4[r5]
            r5 = r5 & 255(0xff, float:3.57E-43)
            int r14 = r12 + 1
            r12 = r2[r12]
            if (r5 == r12) goto L44
            return r10
        L44:
            if (r14 != r13) goto L48
            r5 = 1
            goto L49
        L48:
            r5 = r7
        L49:
            if (r8 != r6) goto L70
            if (r9 == 0) goto L6c
            l.v r4 = r9.f
            if (r4 == 0) goto L68
            int r6 = r4.b
            byte[] r8 = r4.a
            int r9 = r4.c
            if (r4 != r0) goto L62
            if (r5 != 0) goto L5f
        L5b:
            if (r19 == 0) goto L5e
            return r1
        L5e:
            return r10
        L5f:
            r4 = r8
            r8 = r11
            goto L76
        L62:
            r16 = r8
            r8 = r4
            r4 = r16
            goto L76
        L68:
            j.p0.d.r.p()
            throw r11
        L6c:
            j.p0.d.r.p()
            throw r11
        L70:
            r16 = r9
            r9 = r6
            r6 = r8
            r8 = r16
        L76:
            if (r5 == 0) goto L7e
            r5 = r2[r14]
            r13 = r6
            r6 = r9
            r9 = r8
            goto Lac
        L7e:
            r5 = r6
            r6 = r9
            r12 = r14
            r9 = r8
            goto L37
        L83:
            int r13 = r5 + 1
            r5 = r4[r5]
            r5 = r5 & 255(0xff, float:3.57E-43)
            int r14 = r12 + r8
        L8b:
            if (r12 != r14) goto L8e
            return r10
        L8e:
            r15 = r2[r12]
            if (r5 != r15) goto Lb3
            int r12 = r12 + r8
            r5 = r2[r12]
            if (r13 != r6) goto Lac
            l.v r9 = r9.f
            if (r9 == 0) goto La8
            int r4 = r9.b
            byte[] r6 = r9.a
            int r8 = r9.c
            r13 = r4
            r4 = r6
            r6 = r8
            if (r9 != r0) goto Lac
            r9 = r11
            goto Lac
        La8:
            j.p0.d.r.p()
            throw r11
        Lac:
            if (r5 < 0) goto Laf
            return r5
        Laf:
            int r8 = -r5
            r5 = r13
            goto L22
        Lb3:
            int r12 = r12 + 1
            goto L8b
        Lb6:
            if (r19 == 0) goto Lb9
            goto Lba
        Lb9:
            r1 = r3
        Lba:
            return r1
        */
        throw new UnsupportedOperationException("Method not decompiled: l.c0.a.c(l.f, l.q, boolean):int");
    }

    public static /* synthetic */ int d(f fVar, q qVar, boolean z, int i2, Object obj) {
        if ((i2 & 2) != 0) {
            z = false;
        }
        return c(fVar, qVar, z);
    }
}
