package l2;

import I2.C0334s;
import android.util.Log;
import androidx.profileinstaller.ProfileInstallReceiver;
import com.google.firebase.sessions.settings.RemoteSettings;
import h1.m;
import java.io.InputStream;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import k4.g0;
import kotlin.jvm.internal.o;
import l1.B;
import m4.S0;
import m4.Z0;
import n2.AbstractC2612c;
import p.c0;
import p.n0;
import p0.AbstractC2690H;
import p0.InterfaceC2712s;
import q.AbstractC2798s;
import q.C2754E;
import q.C2800t;
import q.InterfaceC2753D;

/* JADX INFO: loaded from: classes.dex */
public final class c implements d, Z0, B {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final /* synthetic */ int f20266a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public Object f20267b;

    public /* synthetic */ c(Object obj, int i6) {
        this.f20266a = i6;
        this.f20267b = obj;
    }

    @Override // l2.d
    public void a(int i6, Serializable serializable) {
        String str;
        switch (i6) {
            case 1:
                str = "RESULT_INSTALL_SUCCESS";
                break;
            case 2:
                str = "RESULT_ALREADY_INSTALLED";
                break;
            case 3:
                str = "RESULT_UNSUPPORTED_ART_VERSION";
                break;
            case 4:
                str = "RESULT_NOT_WRITABLE";
                break;
            case 5:
                str = "RESULT_DESIRED_FORMAT_UNSUPPORTED";
                break;
            case 6:
                str = "RESULT_BASELINE_PROFILE_NOT_FOUND";
                break;
            case 7:
                str = "RESULT_IO_EXCEPTION";
                break;
            case 8:
                str = "RESULT_PARSE_EXCEPTION";
                break;
            case 9:
            default:
                str = "";
                break;
            case 10:
                str = "RESULT_INSTALL_SKIP_FILE_SUCCESS";
                break;
            case 11:
                str = "RESULT_DELETE_SKIP_FILE_SUCCESS";
                break;
        }
        if (i6 == 6 || i6 == 7 || i6 == 8) {
            Log.e("ProfileInstaller", str, (Throwable) serializable);
        } else {
            Log.d("ProfileInstaller", str);
        }
        ((ProfileInstallReceiver) this.f20267b).setResultCode(i6);
    }

    @Override // l1.B
    public long b(h1.k kVar, long j4, m mVar, long j6) {
        long j7 = ((h1.j) ((J4.a) this.f20267b).invoke()).f16621a;
        return (((long) AbstractC2612c.c(kVar.f16623a + ((int) (j7 >> 32)), (int) (j6 >> 32), (int) (j4 >> 32), mVar == m.f16628a)) << 32) | (((long) AbstractC2612c.c(kVar.f16624b + ((int) (j7 & 4294967295L)), (int) (j6 & 4294967295L), (int) (j4 & 4294967295L), true)) & 4294967295L);
    }

    @Override // l2.d
    public void c() {
        Log.d("ProfileInstaller", "DIAGNOSTIC_PROFILE_IS_COMPRESSED");
    }

    public Object d(i5.g descriptor, m5.m mVar) {
        o.h(descriptor, "descriptor");
        Map map = (Map) ((ConcurrentHashMap) this.f20267b).get(descriptor);
        Object obj = map != null ? map.get(mVar) : null;
        if (obj == null) {
            return null;
        }
        return obj;
    }

    public InterfaceC2753D e(int i6) {
        switch (this.f20266a) {
            case 12:
                return ((C2754E[]) this.f20267b)[i6];
            case 13:
                return (C2754E) this.f20267b;
            default:
                return (InterfaceC2753D) this.f20267b;
        }
    }

    public void f(float f6, float f7, float f8, float f9) {
        o4.f fVar = (o4.f) this.f20267b;
        InterfaceC2712s interfaceC2712sC = fVar.c();
        float fIntBitsToFloat = Float.intBitsToFloat((int) (fVar.f() >> 32)) - (f8 + f6);
        long jFloatToRawIntBits = (((long) Float.floatToRawIntBits(Float.intBitsToFloat((int) (fVar.f() & 4294967295L)) - (f9 + f7))) & 4294967295L) | (((long) Float.floatToRawIntBits(fIntBitsToFloat)) << 32);
        if (!(Float.intBitsToFloat((int) (jFloatToRawIntBits >> 32)) >= 0.0f && Float.intBitsToFloat((int) (jFloatToRawIntBits & 4294967295L)) >= 0.0f)) {
            AbstractC2690H.a("Width and height must be greater than or equal to zero");
        }
        fVar.o(jFloatToRawIntBits);
        interfaceC2712sC.p(f6, f7);
    }

    public InputStream g() {
        InputStream inputStream = (InputStream) this.f20267b;
        this.f20267b = null;
        return inputStream;
    }

    public void h(float f6, long j4) {
        InterfaceC2712s interfaceC2712sC = ((o4.f) this.f20267b).c();
        int i6 = (int) (j4 >> 32);
        int i7 = (int) (j4 & 4294967295L);
        interfaceC2712sC.p(Float.intBitsToFloat(i6), Float.intBitsToFloat(i7));
        interfaceC2712sC.c(f6);
        interfaceC2712sC.p(-Float.intBitsToFloat(i6), -Float.intBitsToFloat(i7));
    }

    public void i(float f6, float f7, long j4) {
        InterfaceC2712s interfaceC2712sC = ((o4.f) this.f20267b).c();
        int i6 = (int) (j4 >> 32);
        int i7 = (int) (j4 & 4294967295L);
        interfaceC2712sC.p(Float.intBitsToFloat(i6), Float.intBitsToFloat(i7));
        interfaceC2712sC.b(f6, f7);
        interfaceC2712sC.p(-Float.intBitsToFloat(i6), -Float.intBitsToFloat(i7));
    }

    public void j(float f6, float f7) {
        ((o4.f) this.f20267b).c().p(f6, f7);
    }

    public void k(boolean z6) {
        S0 s02 = (S0) this.f20267b;
        s02.f20785Z.l(s02.f20766E, z6);
    }

    public void l(g0 g0Var, byte[] bArr) {
        u4.b.c();
        try {
            String str = RemoteSettings.FORWARD_SLASH_STRING + ((n4.k) this.f20267b).f21695j.f19879b;
            if (bArr != null) {
                ((n4.k) this.f20267b).f21701q = true;
                str = str + "?" + G3.e.f2061c.c(bArr);
            }
            synchronized (((n4.k) this.f20267b).f21698n.f21690w) {
                n4.j.j(((n4.k) this.f20267b).f21698n, g0Var, str);
            }
            u4.b.f24588a.getClass();
        } catch (Throwable th) {
            try {
                u4.b.f24588a.getClass();
            } catch (Throwable th2) {
                th.addSuppressed(th2);
            }
            throw th;
        }
    }

    public String toString() {
        switch (this.f20266a) {
            case 9:
                StringBuilder sb = new StringBuilder();
                String[] strArr = (String[]) this.f20267b;
                int length = strArr.length / 2;
                for (int i6 = 0; i6 < length; i6++) {
                    int i7 = i6 * 2;
                    String str = null;
                    sb.append((i7 < 0 || i7 >= strArr.length) ? null : strArr[i7]);
                    sb.append(": ");
                    int i8 = i7 + 1;
                    if (i8 >= 0 && i8 < strArr.length) {
                        str = strArr[i8];
                    }
                    sb.append(str);
                    sb.append("\n");
                }
                return sb.toString();
            default:
                return super.toString();
        }
    }

    public c(int i6) {
        this.f20266a = i6;
        switch (i6) {
            case 7:
                this.f20267b = new ConcurrentHashMap(16);
                break;
            case 17:
                this.f20267b = new LinkedHashMap();
                break;
        }
    }

    public c(h1.c cVar) {
        this.f20266a = 10;
        this.f20267b = new c0(n0.f22776a, cVar);
    }

    public c(C0334s c0334s) {
        this.f20266a = 9;
        ArrayList arrayList = c0334s.f2658b;
        this.f20267b = (String[]) arrayList.toArray(new String[arrayList.size()]);
    }

    /* JADX WARN: Removed duplicated region for block: B:14:0x002a A[PHI: r11
      0x002a: PHI (r11v1 int) = (r11v0 int), (r11v8 int), (r11v9 int) binds: [B:5:0x001a, B:10:0x0023, B:12:0x0026] A[DONT_GENERATE, DONT_INLINE]] */
    /* JADX WARN: Removed duplicated region for block: B:19:0x0033  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public c(int[] iArr, float[] fArr, float[][] fArr2) {
        int i6;
        this.f20266a = 11;
        int length = fArr.length - 1;
        C2800t[][] c2800tArr = new C2800t[length][];
        int i7 = 1;
        int i8 = 1;
        int i9 = 0;
        while (i9 < length) {
            int i10 = iArr[i9];
            int i11 = 3;
            if (i10 == 0) {
                i6 = i11;
            } else if (i10 == 1) {
                i7 = 1;
                i6 = i7;
            } else {
                if (i10 != 2) {
                    if (i10 != 3) {
                        i11 = 4;
                        if (i10 != 4) {
                            i11 = 5;
                            if (i10 != 5) {
                                i6 = i8;
                            }
                        }
                    } else {
                        if (i7 == 1) {
                        }
                        i6 = i7;
                    }
                }
                i7 = 2;
                i6 = i7;
            }
            float[] fArr3 = fArr2[i9];
            int i12 = i9 + 1;
            float[] fArr4 = fArr2[i12];
            float f6 = fArr[i9];
            float f7 = fArr[i12];
            int length2 = (fArr3.length % 2) + (fArr3.length / 2);
            C2800t[] c2800tArr2 = new C2800t[length2];
            int i13 = 0;
            while (i13 < length2) {
                int i14 = i13 * 2;
                C2800t[] c2800tArr3 = c2800tArr2;
                int i15 = i13;
                int i16 = i14 + 1;
                c2800tArr3[i15] = new C2800t(i6, f6, f7, fArr3[i14], fArr3[i16], fArr4[i14], fArr4[i16]);
                i13 = i15 + 1;
                c2800tArr2 = c2800tArr3;
            }
            c2800tArr[i9] = c2800tArr2;
            i9 = i12;
            i8 = i6;
        }
        this.f20267b = c2800tArr;
    }

    public c(float f6, float f7, AbstractC2798s abstractC2798s) {
        this.f20266a = 12;
        int iB = abstractC2798s.b();
        C2754E[] c2754eArr = new C2754E[iB];
        for (int i6 = 0; i6 < iB; i6++) {
            c2754eArr[i6] = new C2754E(f6, f7, abstractC2798s.a(i6));
        }
        this.f20267b = c2754eArr;
    }

    public c(float f6, float f7) {
        this.f20266a = 13;
        this.f20267b = new C2754E(f6, f7, 0.01f);
    }
}
