package com.tencent.mm.modelsfs;

import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.ttpic.baseutils.IOUtils;
import java.util.EnumSet;

final class g {

    public enum a {
        NOESCAPE,
        PATHNAME,
        PERIOD,
        LEADING_DIR,
        CASEFOLD;

        static {
            AppMethodBeat.o(93207);
        }
    }

    /* JADX WARNING: Removed duplicated region for block: B:39:0x0094  */
    /* JADX WARNING: Removed duplicated region for block: B:103:0x008f A:{SYNTHETIC} */
    static boolean a(java.lang.String r8, int r9, java.lang.String r10, int r11, java.util.EnumSet<com.tencent.mm.modelsfs.g.a> r12) {
        /*
        r7 = -1;
        r2 = 1;
        r6 = 47;
        r3 = 0;
        r5 = 93208; // 0x16c18 float:1.30612E-40 double:4.6051E-319;
        com.tencent.matrix.trace.core.AppMethodBeat.i(r5);
    L_0x000b:
        r0 = r8.length();
        if (r9 < r0) goto L_0x0034;
    L_0x0011:
        r0 = com.tencent.mm.modelsfs.g.a.LEADING_DIR;
        r0 = r12.contains(r0);
        if (r0 == 0) goto L_0x0024;
    L_0x0019:
        r0 = r10.charAt(r11);
        if (r0 != r6) goto L_0x0024;
    L_0x001f:
        com.tencent.matrix.trace.core.AppMethodBeat.o(r5);
        r0 = r2;
    L_0x0023:
        return r0;
    L_0x0024:
        r0 = r10.length();
        if (r11 != r0) goto L_0x002f;
    L_0x002a:
        com.tencent.matrix.trace.core.AppMethodBeat.o(r5);
        r0 = r2;
        goto L_0x0023;
    L_0x002f:
        com.tencent.matrix.trace.core.AppMethodBeat.o(r5);
        r0 = r3;
        goto L_0x0023;
    L_0x0034:
        r0 = r9 + 1;
        r1 = r8.charAt(r9);
        switch(r1) {
            case 42: goto L_0x0194;
            case 63: goto L_0x0049;
            case 91: goto L_0x0111;
            case 92: goto L_0x0153;
            default: goto L_0x003d;
        };
    L_0x003d:
        r9 = r0;
    L_0x003e:
        r0 = r10.length();
        if (r11 < r0) goto L_0x016e;
    L_0x0044:
        com.tencent.matrix.trace.core.AppMethodBeat.o(r5);
        r0 = r3;
        goto L_0x0023;
    L_0x0049:
        r1 = r10.length();
        if (r11 < r1) goto L_0x0054;
    L_0x004f:
        com.tencent.matrix.trace.core.AppMethodBeat.o(r5);
        r0 = r3;
        goto L_0x0023;
    L_0x0054:
        r1 = r10.charAt(r11);
        if (r1 != r6) goto L_0x0067;
    L_0x005a:
        r1 = com.tencent.mm.modelsfs.g.a.PATHNAME;
        r1 = r12.contains(r1);
        if (r1 == 0) goto L_0x0067;
    L_0x0062:
        com.tencent.matrix.trace.core.AppMethodBeat.o(r5);
        r0 = r3;
        goto L_0x0023;
    L_0x0067:
        r1 = a(r10, r11, r12);
        if (r1 == 0) goto L_0x0072;
    L_0x006d:
        com.tencent.matrix.trace.core.AppMethodBeat.o(r5);
        r0 = r3;
        goto L_0x0023;
    L_0x0072:
        r11 = r11 + 1;
        r9 = r0;
        goto L_0x000b;
    L_0x0076:
        r0 = r8.length();
        if (r9 >= r0) goto L_0x0088;
    L_0x007c:
        r0 = r8.charAt(r9);
        r1 = 42;
        if (r0 != r1) goto L_0x0089;
    L_0x0084:
        r9 = r9 + 1;
        r1 = r0;
        goto L_0x0076;
    L_0x0088:
        r0 = r1;
    L_0x0089:
        r1 = a(r10, r11, r12);
        if (r1 == 0) goto L_0x0094;
    L_0x008f:
        com.tencent.matrix.trace.core.AppMethodBeat.o(r5);
        r0 = r3;
        goto L_0x0023;
    L_0x0094:
        r1 = r8.length();
        if (r9 != r1) goto L_0x00c2;
    L_0x009a:
        r0 = com.tencent.mm.modelsfs.g.a.PATHNAME;
        r0 = r12.contains(r0);
        if (r0 == 0) goto L_0x00bc;
    L_0x00a2:
        r0 = com.tencent.mm.modelsfs.g.a.LEADING_DIR;
        r0 = r12.contains(r0);
        if (r0 != 0) goto L_0x00b0;
    L_0x00aa:
        r0 = r10.indexOf(r6, r11);
        if (r0 != r7) goto L_0x00b6;
    L_0x00b0:
        com.tencent.matrix.trace.core.AppMethodBeat.o(r5);
        r0 = r2;
        goto L_0x0023;
    L_0x00b6:
        com.tencent.matrix.trace.core.AppMethodBeat.o(r5);
        r0 = r3;
        goto L_0x0023;
    L_0x00bc:
        com.tencent.matrix.trace.core.AppMethodBeat.o(r5);
        r0 = r2;
        goto L_0x0023;
    L_0x00c2:
        if (r0 != r6) goto L_0x00e8;
    L_0x00c4:
        r0 = com.tencent.mm.modelsfs.g.a.PATHNAME;
        r0 = r12.contains(r0);
        if (r0 == 0) goto L_0x00e8;
    L_0x00cc:
        r11 = r10.indexOf(r6, r11);
        if (r11 != r7) goto L_0x000b;
    L_0x00d2:
        com.tencent.matrix.trace.core.AppMethodBeat.o(r5);
        r0 = r3;
        goto L_0x0023;
    L_0x00d8:
        r0 = r10.charAt(r11);
        if (r0 != r6) goto L_0x00e6;
    L_0x00de:
        r0 = com.tencent.mm.modelsfs.g.a.PATHNAME;
        r0 = r12.contains(r0);
        if (r0 != 0) goto L_0x010b;
    L_0x00e6:
        r11 = r11 + 1;
    L_0x00e8:
        r0 = r10.length();
        if (r11 >= r0) goto L_0x010b;
    L_0x00ee:
        r0 = com.tencent.mm.modelsfs.g.a.PERIOD;
        r0 = r12.contains(r0);
        if (r0 == 0) goto L_0x00ff;
    L_0x00f6:
        r12 = java.util.EnumSet.copyOf(r12);
        r0 = com.tencent.mm.modelsfs.g.a.PERIOD;
        r12.remove(r0);
    L_0x00ff:
        r0 = a(r8, r9, r10, r11, r12);
        if (r0 == 0) goto L_0x00d8;
    L_0x0105:
        com.tencent.matrix.trace.core.AppMethodBeat.o(r5);
        r0 = r2;
        goto L_0x0023;
    L_0x010b:
        com.tencent.matrix.trace.core.AppMethodBeat.o(r5);
        r0 = r3;
        goto L_0x0023;
    L_0x0111:
        r4 = r10.length();
        if (r11 < r4) goto L_0x011d;
    L_0x0117:
        com.tencent.matrix.trace.core.AppMethodBeat.o(r5);
        r0 = r3;
        goto L_0x0023;
    L_0x011d:
        r4 = r10.charAt(r11);
        if (r4 != r6) goto L_0x0131;
    L_0x0123:
        r4 = com.tencent.mm.modelsfs.g.a.PATHNAME;
        r4 = r12.contains(r4);
        if (r4 == 0) goto L_0x0131;
    L_0x012b:
        com.tencent.matrix.trace.core.AppMethodBeat.o(r5);
        r0 = r3;
        goto L_0x0023;
    L_0x0131:
        r4 = a(r10, r11, r12);
        if (r4 == 0) goto L_0x013d;
    L_0x0137:
        com.tencent.matrix.trace.core.AppMethodBeat.o(r5);
        r0 = r3;
        goto L_0x0023;
    L_0x013d:
        r4 = r10.charAt(r11);
        r9 = a(r8, r0, r4, r12);
        if (r9 == r7) goto L_0x003d;
    L_0x0147:
        if (r9 != 0) goto L_0x014f;
    L_0x0149:
        com.tencent.matrix.trace.core.AppMethodBeat.o(r5);
        r0 = r3;
        goto L_0x0023;
    L_0x014f:
        r11 = r11 + 1;
        goto L_0x000b;
    L_0x0153:
        r4 = com.tencent.mm.modelsfs.g.a.NOESCAPE;
        r4 = r12.contains(r4);
        if (r4 != 0) goto L_0x003d;
    L_0x015b:
        r1 = r8.length();
        if (r0 < r1) goto L_0x0166;
    L_0x0161:
        r1 = 92;
        r9 = r0;
        goto L_0x003e;
    L_0x0166:
        r9 = r0 + 1;
        r1 = r8.charAt(r0);
        goto L_0x003e;
    L_0x016e:
        r0 = r10.charAt(r11);
        if (r1 == r0) goto L_0x0190;
    L_0x0174:
        r0 = com.tencent.mm.modelsfs.g.a.CASEFOLD;
        r0 = r12.contains(r0);
        if (r0 == 0) goto L_0x018a;
    L_0x017c:
        r0 = java.lang.Character.toLowerCase(r1);
        r1 = r10.charAt(r11);
        r1 = java.lang.Character.toLowerCase(r1);
        if (r0 == r1) goto L_0x0190;
    L_0x018a:
        com.tencent.matrix.trace.core.AppMethodBeat.o(r5);
        r0 = r3;
        goto L_0x0023;
    L_0x0190:
        r11 = r11 + 1;
        goto L_0x000b;
    L_0x0194:
        r9 = r0;
        goto L_0x0076;
        */
        throw new UnsupportedOperationException("Method not decompiled: com.tencent.mm.modelsfs.g.a(java.lang.String, int, java.lang.String, int, java.util.EnumSet):boolean");
    }

    private static boolean a(String str, int i, EnumSet<a> enumSet) {
        AppMethodBeat.i(93209);
        if (i > str.length() - 1) {
            AppMethodBeat.o(93209);
            return false;
        } else if ((i == 0 || (enumSet.contains(a.PATHNAME) && str.charAt(i - 1) == IOUtils.DIR_SEPARATOR_UNIX)) && str.charAt(i) == '.' && enumSet.contains(a.PERIOD)) {
            AppMethodBeat.o(93209);
            return true;
        } else {
            AppMethodBeat.o(93209);
            return false;
        }
    }

    private static int a(String str, int i, char c, EnumSet<a> enumSet) {
        AppMethodBeat.i(93210);
        if (i >= str.length()) {
            AppMethodBeat.o(93210);
            return -1;
        }
        char charAt = str.charAt(i);
        int i2 = (charAt == '!' || charAt == '^') ? 1 : 0;
        if (i2 != 0) {
            i++;
        }
        if (enumSet.contains(a.CASEFOLD)) {
            c = Character.toLowerCase(c);
        }
        int i3 = 0;
        while (i < str.length()) {
            int i4 = i + 1;
            char charAt2 = str.charAt(i);
            if (charAt2 != ']') {
                if (charAt2 != IOUtils.DIR_SEPARATOR_WINDOWS || enumSet.contains(a.NOESCAPE)) {
                    i = i4;
                } else {
                    i = i4 + 1;
                    charAt2 = str.charAt(i4);
                }
                if (charAt2 == IOUtils.DIR_SEPARATOR_UNIX && enumSet.contains(a.PATHNAME)) {
                    AppMethodBeat.o(93210);
                    return 0;
                }
                if (enumSet.contains(a.CASEFOLD)) {
                    charAt2 = Character.toLowerCase(charAt2);
                }
                if (str.charAt(i) == '-' && i + 1 < str.length()) {
                    char charAt3 = str.charAt(i + 1);
                    if (charAt3 != ']') {
                        i4 = i + 2;
                        if (charAt3 != IOUtils.DIR_SEPARATOR_WINDOWS || enumSet.contains(a.NOESCAPE)) {
                            i = i4;
                        } else if (i4 >= str.length()) {
                            AppMethodBeat.o(93210);
                            return -1;
                        } else {
                            i = i4 + 1;
                            charAt2 = str.charAt(i4);
                        }
                        char toLowerCase;
                        if (enumSet.contains(a.CASEFOLD)) {
                            toLowerCase = Character.toLowerCase(charAt3);
                        } else {
                            toLowerCase = charAt3;
                        }
                        if (charAt2 <= c && c <= toLowerCase) {
                            i3 = 1;
                        }
                    }
                }
                if (charAt2 == c) {
                    i3 = 1;
                }
            } else if (i3 == i2) {
                AppMethodBeat.o(93210);
                return 0;
            } else {
                AppMethodBeat.o(93210);
                return i4;
            }
        }
        AppMethodBeat.o(93210);
        return -1;
    }
}
