package k1;

import l1.C0622e;

/* JADX INFO: loaded from: classes.dex */
class f0 {

    /* JADX INFO: renamed from: j, reason: collision with root package name */
    private static int f4864j;

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    int f4865a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    int f4866b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    String f4867c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    String f4868d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    String f4869e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    c0 f4870f;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    boolean f4871g;

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    boolean f4872h;

    /* JADX INFO: renamed from: i, reason: collision with root package name */
    int f4873i;

    f0(c0 c0Var, String str, String str2) {
        this.f4868d = "?????";
        this.f4870f = c0Var;
        this.f4867c = str.toUpperCase();
        if (str2 != null && !str2.startsWith("??")) {
            this.f4868d = str2;
        }
        this.f4869e = this.f4868d;
        this.f4865a = 0;
    }

    boolean a(String str, String str2) {
        return this.f4867c.equalsIgnoreCase(str) && (str2 == null || str2.startsWith("??") || this.f4868d.equalsIgnoreCase(str2));
    }

    void b(AbstractC0600r abstractC0600r, AbstractC0600r abstractC0600r2) {
        String str;
        byte b2;
        synchronized (this.f4870f.f()) {
            if (abstractC0600r2 != null) {
                try {
                    abstractC0600r2.f5012f0 = false;
                } finally {
                }
            }
            c(abstractC0600r, abstractC0600r2);
            if (abstractC0600r != null && (abstractC0600r2 == null || !abstractC0600r2.f5012f0)) {
                if (!this.f4868d.equals("A:") && (b2 = abstractC0600r.f5021r) != -94 && b2 != 4) {
                    if (b2 == 37 || b2 == 50) {
                        int i2 = ((AbstractC0574K) abstractC0600r).f4622M0 & 255;
                        if (i2 != 0 && i2 != 16 && i2 != 35 && i2 != 38 && i2 != 104 && i2 != 215 && i2 != 83 && i2 != 84) {
                            throw new V("Invalid operation for " + this.f4868d + " service");
                        }
                    } else if (b2 != 113) {
                        switch (b2) {
                            case 45:
                            case 46:
                            case 47:
                                break;
                            default:
                                throw new V("Invalid operation for " + this.f4868d + " service" + abstractC0600r);
                        }
                    }
                }
                abstractC0600r.f5005Q = this.f4866b;
                if (this.f4871g && !this.f4868d.equals("IPC") && (str = abstractC0600r.f5018l0) != null && str.length() > 0) {
                    abstractC0600r.f5004M = 4096;
                    abstractC0600r.f5018l0 = '\\' + this.f4870f.f().f4843s0 + '\\' + this.f4867c + abstractC0600r.f5018l0;
                }
                try {
                    this.f4870f.d(abstractC0600r, abstractC0600r2);
                } catch (V e2) {
                    if (e2.c() == -1073741623) {
                        d(true);
                    }
                    throw e2;
                }
            }
        }
    }

    /* JADX WARN: Code restructure failed: missing block: B:20:0x002b, code lost:
    
        r7.f4865a = 1;
     */
    /* JADX WARN: Code restructure failed: missing block: B:21:0x002d, code lost:
    
        r7.f4870f.f4790h.n();
        r2 = "\\\\" + r7.f4870f.f4790h.f4843s0 + '\\' + r7.f4867c;
        r7.f4868d = r7.f4869e;
        r4 = r7.f4870f.f4790h;
        r4 = k1.e0.f4817t0;
     */
    /* JADX WARN: Code restructure failed: missing block: B:22:0x0062, code lost:
    
        if (l1.C0622e.f5384g < 4) goto L26;
     */
    /* JADX WARN: Code restructure failed: missing block: B:23:0x0064, code lost:
    
        k1.e0.f4819v0.println("treeConnect: unc=" + r2 + ",service=" + r7.f4868d);
     */
    /* JADX WARN: Code restructure failed: missing block: B:24:0x0086, code lost:
    
        r8 = move-exception;
     */
    /* JADX WARN: Code restructure failed: missing block: B:26:0x0088, code lost:
    
        r4 = new k1.C0577N(r9);
        r7.f4870f.d(new k1.C0576M(r7.f4870f, r2, r7.f4868d, r8), r4);
        r7.f4866b = r4.f5005Q;
        r7.f4868d = r4.f4668v0;
        r7.f4871g = r4.f4667u0;
        r8 = k1.f0.f4864j;
        k1.f0.f4864j = r8 + 1;
        r7.f4873i = r8;
        r7.f4865a = 2;
     */
    /* JADX WARN: Code restructure failed: missing block: B:28:0x00b2, code lost:
    
        return;
     */
    /* JADX WARN: Code restructure failed: missing block: B:29:0x00b3, code lost:
    
        d(true);
        r7.f4865a = 0;
     */
    /* JADX WARN: Code restructure failed: missing block: B:30:0x00b9, code lost:
    
        throw r8;
     */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    void c(k1.AbstractC0600r r8, k1.AbstractC0600r r9) {
        /*
            r7 = this;
            r0 = 1
            k1.c0 r1 = r7.f4870f
            k1.e0 r1 = r1.f()
            monitor-enter(r1)
        L8:
            int r2 = r7.f4865a     // Catch: java.lang.Throwable -> L1b
            r3 = 2
            if (r2 == 0) goto L2b
            if (r2 == r3) goto L29
            r3 = 3
            if (r2 != r3) goto L13
            goto L29
        L13:
            k1.c0 r2 = r7.f4870f     // Catch: java.lang.Throwable -> L1b java.lang.InterruptedException -> L1e
            k1.e0 r2 = r2.f4790h     // Catch: java.lang.Throwable -> L1b java.lang.InterruptedException -> L1e
            r2.wait()     // Catch: java.lang.Throwable -> L1b java.lang.InterruptedException -> L1e
            goto L8
        L1b:
            r8 = move-exception
            goto Lba
        L1e:
            r8 = move-exception
            k1.V r9 = new k1.V     // Catch: java.lang.Throwable -> L1b
            java.lang.String r0 = r8.getMessage()     // Catch: java.lang.Throwable -> L1b
            r9.<init>(r0, r8)     // Catch: java.lang.Throwable -> L1b
            throw r9     // Catch: java.lang.Throwable -> L1b
        L29:
            monitor-exit(r1)     // Catch: java.lang.Throwable -> L1b
            return
        L2b:
            r7.f4865a = r0     // Catch: java.lang.Throwable -> L1b
            k1.c0 r2 = r7.f4870f     // Catch: java.lang.Throwable -> L1b k1.V -> L86
            k1.e0 r2 = r2.f4790h     // Catch: java.lang.Throwable -> L1b k1.V -> L86
            r2.n()     // Catch: java.lang.Throwable -> L1b k1.V -> L86
            java.lang.StringBuilder r2 = new java.lang.StringBuilder     // Catch: java.lang.Throwable -> L1b k1.V -> L86
            r2.<init>()     // Catch: java.lang.Throwable -> L1b k1.V -> L86
            java.lang.String r4 = "\\\\"
            r2.append(r4)     // Catch: java.lang.Throwable -> L1b k1.V -> L86
            k1.c0 r4 = r7.f4870f     // Catch: java.lang.Throwable -> L1b k1.V -> L86
            k1.e0 r4 = r4.f4790h     // Catch: java.lang.Throwable -> L1b k1.V -> L86
            java.lang.String r4 = r4.f4843s0     // Catch: java.lang.Throwable -> L1b k1.V -> L86
            r2.append(r4)     // Catch: java.lang.Throwable -> L1b k1.V -> L86
            r4 = 92
            r2.append(r4)     // Catch: java.lang.Throwable -> L1b k1.V -> L86
            java.lang.String r4 = r7.f4867c     // Catch: java.lang.Throwable -> L1b k1.V -> L86
            r2.append(r4)     // Catch: java.lang.Throwable -> L1b k1.V -> L86
            java.lang.String r2 = r2.toString()     // Catch: java.lang.Throwable -> L1b k1.V -> L86
            java.lang.String r4 = r7.f4869e     // Catch: java.lang.Throwable -> L1b k1.V -> L86
            r7.f4868d = r4     // Catch: java.lang.Throwable -> L1b k1.V -> L86
            k1.c0 r4 = r7.f4870f     // Catch: java.lang.Throwable -> L1b k1.V -> L86
            k1.e0 r4 = r4.f4790h     // Catch: java.lang.Throwable -> L1b k1.V -> L86
            byte[] r4 = k1.e0.f4817t0     // Catch: java.lang.Throwable -> L1b k1.V -> L86
            int r4 = l1.C0622e.f5384g     // Catch: java.lang.Throwable -> L1b k1.V -> L86
            r5 = 4
            if (r4 < r5) goto L88
            l1.e r4 = k1.e0.f4819v0     // Catch: java.lang.Throwable -> L1b k1.V -> L86
            java.lang.StringBuilder r5 = new java.lang.StringBuilder     // Catch: java.lang.Throwable -> L1b k1.V -> L86
            r5.<init>()     // Catch: java.lang.Throwable -> L1b k1.V -> L86
            java.lang.String r6 = "treeConnect: unc="
            r5.append(r6)     // Catch: java.lang.Throwable -> L1b k1.V -> L86
            r5.append(r2)     // Catch: java.lang.Throwable -> L1b k1.V -> L86
            java.lang.String r6 = ",service="
            r5.append(r6)     // Catch: java.lang.Throwable -> L1b k1.V -> L86
            java.lang.String r6 = r7.f4868d     // Catch: java.lang.Throwable -> L1b k1.V -> L86
            r5.append(r6)     // Catch: java.lang.Throwable -> L1b k1.V -> L86
            java.lang.String r5 = r5.toString()     // Catch: java.lang.Throwable -> L1b k1.V -> L86
            r4.println(r5)     // Catch: java.lang.Throwable -> L1b k1.V -> L86
            goto L88
        L86:
            r8 = move-exception
            goto Lb3
        L88:
            k1.N r4 = new k1.N     // Catch: java.lang.Throwable -> L1b k1.V -> L86
            r4.<init>(r9)     // Catch: java.lang.Throwable -> L1b k1.V -> L86
            k1.M r9 = new k1.M     // Catch: java.lang.Throwable -> L1b k1.V -> L86
            k1.c0 r5 = r7.f4870f     // Catch: java.lang.Throwable -> L1b k1.V -> L86
            java.lang.String r6 = r7.f4868d     // Catch: java.lang.Throwable -> L1b k1.V -> L86
            r9.<init>(r5, r2, r6, r8)     // Catch: java.lang.Throwable -> L1b k1.V -> L86
            k1.c0 r8 = r7.f4870f     // Catch: java.lang.Throwable -> L1b k1.V -> L86
            r8.d(r9, r4)     // Catch: java.lang.Throwable -> L1b k1.V -> L86
            int r8 = r4.f5005Q     // Catch: java.lang.Throwable -> L1b k1.V -> L86
            r7.f4866b = r8     // Catch: java.lang.Throwable -> L1b k1.V -> L86
            java.lang.String r8 = r4.f4668v0     // Catch: java.lang.Throwable -> L1b k1.V -> L86
            r7.f4868d = r8     // Catch: java.lang.Throwable -> L1b k1.V -> L86
            boolean r8 = r4.f4667u0     // Catch: java.lang.Throwable -> L1b k1.V -> L86
            r7.f4871g = r8     // Catch: java.lang.Throwable -> L1b k1.V -> L86
            int r8 = k1.f0.f4864j     // Catch: java.lang.Throwable -> L1b k1.V -> L86
            int r9 = r8 + 1
            k1.f0.f4864j = r9     // Catch: java.lang.Throwable -> L1b k1.V -> L86
            r7.f4873i = r8     // Catch: java.lang.Throwable -> L1b k1.V -> L86
            r7.f4865a = r3     // Catch: java.lang.Throwable -> L1b k1.V -> L86
            monitor-exit(r1)     // Catch: java.lang.Throwable -> L1b
            return
        Lb3:
            r7.d(r0)     // Catch: java.lang.Throwable -> L1b
            r9 = 0
            r7.f4865a = r9     // Catch: java.lang.Throwable -> L1b
            throw r8     // Catch: java.lang.Throwable -> L1b
        Lba:
            monitor-exit(r1)     // Catch: java.lang.Throwable -> L1b
            throw r8
        */
        throw new UnsupportedOperationException("Method not decompiled: k1.f0.c(k1.r, k1.r):void");
    }

    void d(boolean z2) {
        synchronized (this.f4870f.f()) {
            try {
                if (this.f4865a != 2) {
                    return;
                }
                this.f4865a = 3;
                if (!z2 && this.f4866b != 0) {
                    try {
                        b(new C0578O(), null);
                    } catch (V e2) {
                        e0 e0Var = this.f4870f.f4790h;
                        byte[] bArr = e0.f4817t0;
                        if (C0622e.f5384g > 1) {
                            e2.printStackTrace(e0.f4819v0);
                        }
                    }
                }
                this.f4871g = false;
                this.f4872h = false;
                this.f4865a = 0;
                this.f4870f.f4790h.notifyAll();
            } catch (Throwable th) {
                throw th;
            }
        }
    }

    public boolean equals(Object obj) {
        if (!(obj instanceof f0)) {
            return false;
        }
        f0 f0Var = (f0) obj;
        return a(f0Var.f4867c, f0Var.f4868d);
    }

    public String toString() {
        return "SmbTree[share=" + this.f4867c + ",service=" + this.f4868d + ",tid=" + this.f4866b + ",inDfs=" + this.f4871g + ",inDomainDfs=" + this.f4872h + ",connectionState=" + this.f4865a + "]";
    }
}
