package k1;

import com.mstar.android.samba.OnRecvMsg;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import l1.AbstractC0621d;
import okhttp3.HttpUrl;

/* JADX INFO: loaded from: classes.dex */
public class V extends IOException implements InterfaceC0596n, InterfaceC0588f, z0 {

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

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    private Throwable f4720g;

    V() {
    }

    static String a(int i2) {
        if (i2 == 0) {
            return "NT_STATUS_SUCCESS";
        }
        int i3 = 1;
        if ((i2 & (-1073741824)) == -1073741824) {
            int length = InterfaceC0596n.f4950h.length - 1;
            while (length >= i3) {
                int i4 = (i3 + length) / 2;
                int i5 = InterfaceC0596n.f4950h[i4];
                if (i2 > i5) {
                    i3 = i4 + 1;
                } else {
                    if (i2 >= i5) {
                        return InterfaceC0596n.f4951i[i4];
                    }
                    length = i4 - 1;
                }
            }
        } else {
            int length2 = InterfaceC0588f.f4862e.length - 1;
            int i6 = 0;
            while (length2 >= i6) {
                int i7 = (i6 + length2) / 2;
                int i8 = InterfaceC0588f.f4862e[i7][0];
                if (i2 > i8) {
                    i6 = i7 + 1;
                } else {
                    if (i2 >= i8) {
                        return InterfaceC0588f.f4863f[i7];
                    }
                    length2 = i7 - 1;
                }
            }
        }
        return "0x" + AbstractC0621d.c(i2, 8);
    }

    static String b(int i2) {
        int length = z0.f5078V.length - 1;
        int i3 = 0;
        while (length >= i3) {
            int i4 = (i3 + length) / 2;
            int i5 = z0.f5078V[i4];
            if (i2 > i5) {
                i3 = i4 + 1;
            } else {
                if (i2 >= i5) {
                    return z0.f5079W[i4];
                }
                length = i4 - 1;
            }
        }
        return i2 + HttpUrl.FRAGMENT_ENCODE_SET;
    }

    static int e(int i2) {
        if (((-1073741824) & i2) != 0) {
            return i2;
        }
        int length = InterfaceC0588f.f4862e.length - 1;
        int i3 = 0;
        while (length >= i3) {
            int i4 = (i3 + length) / 2;
            int[] iArr = InterfaceC0588f.f4862e[i4];
            int i5 = iArr[0];
            if (i2 > i5) {
                i3 = i4 + 1;
            } else {
                if (i2 >= i5) {
                    return iArr[1];
                }
                length = i4 - 1;
            }
        }
        return OnRecvMsg.NT_STATUS_UNSUCCESSFUL;
    }

    public int c() {
        return this.f4719b;
    }

    public Throwable d() {
        return this.f4720g;
    }

    @Override // java.lang.Throwable
    public String toString() {
        if (this.f4720g == null) {
            return super.toString();
        }
        StringWriter stringWriter = new StringWriter();
        this.f4720g.printStackTrace(new PrintWriter(stringWriter));
        return super.toString() + "\n" + stringWriter;
    }

    V(int i2, Throwable th) {
        super(a(i2));
        this.f4719b = e(i2);
        this.f4720g = th;
    }

    V(String str) {
        super(str);
        this.f4719b = OnRecvMsg.NT_STATUS_UNSUCCESSFUL;
    }

    V(String str, Throwable th) {
        super(str);
        this.f4720g = th;
        this.f4719b = OnRecvMsg.NT_STATUS_UNSUCCESSFUL;
    }

    public V(int i2, boolean z2) {
        super(z2 ? b(i2) : a(i2));
        this.f4719b = z2 ? i2 : e(i2);
    }
}
