package com.google.android.gms.internal.firebase_ml; import com.google.android.libraries.places.api.model.PlaceTypes; import com.google.common.primitives.UnsignedBytes; import java.lang.reflect.Field; import java.nio.Buffer; import java.security.AccessController; import java.util.logging.Level; import java.util.logging.Logger; import sun.misc.Unsafe; /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes2.dex */ public final class zzxc { private static final Logger logger = Logger.getLogger(zzxc.class.getName()); private static final Class zzbke; private static final boolean zzbkz; private static final Unsafe zzbqw; private static final boolean zzbst; private static final boolean zzbsu; private static final zzd zzbsv; private static final boolean zzbsw; private static final long zzbsx; private static final long zzbsy; private static final long zzbsz; private static final long zzbta; private static final long zzbtb; private static final long zzbtc; private static final long zzbtd; private static final long zzbte; private static final long zzbtf; private static final long zzbtg; private static final long zzbth; private static final long zzbti; private static final long zzbtj; private static final long zzbtk; private static final boolean zzbtl; private zzxc() { } /* loaded from: classes2.dex */ static final class zza extends zzd { zza(Unsafe unsafe) { super(unsafe); } @Override // com.google.android.gms.internal.firebase_ml.zzxc.zzd public final byte zzy(Object obj, long j) { if (zzxc.zzbtl) { return zzxc.zzq(obj, j); } return zzxc.zzr(obj, j); } @Override // com.google.android.gms.internal.firebase_ml.zzxc.zzd public final void zze(Object obj, long j, byte b) { if (zzxc.zzbtl) { zzxc.zza(obj, j, b); } else { zzxc.zzb(obj, j, b); } } @Override // com.google.android.gms.internal.firebase_ml.zzxc.zzd public final boolean zzm(Object obj, long j) { if (zzxc.zzbtl) { return zzxc.zzs(obj, j); } return zzxc.zzt(obj, j); } @Override // com.google.android.gms.internal.firebase_ml.zzxc.zzd public final void zza(Object obj, long j, boolean z) { if (zzxc.zzbtl) { zzxc.zzb(obj, j, z); } else { zzxc.zzc(obj, j, z); } } @Override // com.google.android.gms.internal.firebase_ml.zzxc.zzd public final float zzn(Object obj, long j) { return Float.intBitsToFloat(zzk(obj, j)); } @Override // com.google.android.gms.internal.firebase_ml.zzxc.zzd public final void zza(Object obj, long j, float f) { zza(obj, j, Float.floatToIntBits(f)); } @Override // com.google.android.gms.internal.firebase_ml.zzxc.zzd public final double zzo(Object obj, long j) { return Double.longBitsToDouble(zzl(obj, j)); } @Override // com.google.android.gms.internal.firebase_ml.zzxc.zzd public final void zza(Object obj, long j, double d) { zza(obj, j, Double.doubleToLongBits(d)); } } /* loaded from: classes2.dex */ static final class zzb extends zzd { zzb(Unsafe unsafe) { super(unsafe); } @Override // com.google.android.gms.internal.firebase_ml.zzxc.zzd public final byte zzy(Object obj, long j) { if (zzxc.zzbtl) { return zzxc.zzq(obj, j); } return zzxc.zzr(obj, j); } @Override // com.google.android.gms.internal.firebase_ml.zzxc.zzd public final void zze(Object obj, long j, byte b) { if (zzxc.zzbtl) { zzxc.zza(obj, j, b); } else { zzxc.zzb(obj, j, b); } } @Override // com.google.android.gms.internal.firebase_ml.zzxc.zzd public final boolean zzm(Object obj, long j) { if (zzxc.zzbtl) { return zzxc.zzs(obj, j); } return zzxc.zzt(obj, j); } @Override // com.google.android.gms.internal.firebase_ml.zzxc.zzd public final void zza(Object obj, long j, boolean z) { if (zzxc.zzbtl) { zzxc.zzb(obj, j, z); } else { zzxc.zzc(obj, j, z); } } @Override // com.google.android.gms.internal.firebase_ml.zzxc.zzd public final float zzn(Object obj, long j) { return Float.intBitsToFloat(zzk(obj, j)); } @Override // com.google.android.gms.internal.firebase_ml.zzxc.zzd public final void zza(Object obj, long j, float f) { zza(obj, j, Float.floatToIntBits(f)); } @Override // com.google.android.gms.internal.firebase_ml.zzxc.zzd public final double zzo(Object obj, long j) { return Double.longBitsToDouble(zzl(obj, j)); } @Override // com.google.android.gms.internal.firebase_ml.zzxc.zzd public final void zza(Object obj, long j, double d) { zza(obj, j, Double.doubleToLongBits(d)); } } /* loaded from: classes2.dex */ static final class zzc extends zzd { zzc(Unsafe unsafe) { super(unsafe); } @Override // com.google.android.gms.internal.firebase_ml.zzxc.zzd public final byte zzy(Object obj, long j) { return this.zzbtm.getByte(obj, j); } @Override // com.google.android.gms.internal.firebase_ml.zzxc.zzd public final void zze(Object obj, long j, byte b) { this.zzbtm.putByte(obj, j, b); } @Override // com.google.android.gms.internal.firebase_ml.zzxc.zzd public final boolean zzm(Object obj, long j) { return this.zzbtm.getBoolean(obj, j); } @Override // com.google.android.gms.internal.firebase_ml.zzxc.zzd public final void zza(Object obj, long j, boolean z) { this.zzbtm.putBoolean(obj, j, z); } @Override // com.google.android.gms.internal.firebase_ml.zzxc.zzd public final float zzn(Object obj, long j) { return this.zzbtm.getFloat(obj, j); } @Override // com.google.android.gms.internal.firebase_ml.zzxc.zzd public final void zza(Object obj, long j, float f) { this.zzbtm.putFloat(obj, j, f); } @Override // com.google.android.gms.internal.firebase_ml.zzxc.zzd public final double zzo(Object obj, long j) { return this.zzbtm.getDouble(obj, j); } @Override // com.google.android.gms.internal.firebase_ml.zzxc.zzd public final void zza(Object obj, long j, double d) { this.zzbtm.putDouble(obj, j, d); } } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes2.dex */ public static abstract class zzd { Unsafe zzbtm; zzd(Unsafe unsafe) { this.zzbtm = unsafe; } public abstract void zza(Object obj, long j, double d); public abstract void zza(Object obj, long j, float f); public abstract void zza(Object obj, long j, boolean z); public abstract void zze(Object obj, long j, byte b); public abstract boolean zzm(Object obj, long j); public abstract float zzn(Object obj, long j); public abstract double zzo(Object obj, long j); public abstract byte zzy(Object obj, long j); public final int zzk(Object obj, long j) { return this.zzbtm.getInt(obj, j); } public final void zza(Object obj, long j, int i) { this.zzbtm.putInt(obj, j, i); } public final long zzl(Object obj, long j) { return this.zzbtm.getLong(obj, j); } public final void zza(Object obj, long j, long j2) { this.zzbtm.putLong(obj, j, j2); } } /* JADX INFO: Access modifiers changed from: package-private */ public static T zzm(Class cls) { try { return (T) zzbqw.allocateInstance(cls); } catch (InstantiationException e) { throw new IllegalStateException(e); } } private static int zzn(Class cls) { if (zzbkz) { return zzbsv.zzbtm.arrayBaseOffset(cls); } return -1; } private static int zzo(Class cls) { if (zzbkz) { return zzbsv.zzbtm.arrayIndexScale(cls); } return -1; } /* JADX INFO: Access modifiers changed from: package-private */ public static int zzk(Object obj, long j) { return zzbsv.zzk(obj, j); } /* JADX INFO: Access modifiers changed from: package-private */ public static void zza(Object obj, long j, int i) { zzbsv.zza(obj, j, i); } /* JADX INFO: Access modifiers changed from: package-private */ public static long zzl(Object obj, long j) { return zzbsv.zzl(obj, j); } /* JADX INFO: Access modifiers changed from: package-private */ public static void zza(Object obj, long j, long j2) { zzbsv.zza(obj, j, j2); } /* JADX INFO: Access modifiers changed from: package-private */ public static boolean zzm(Object obj, long j) { return zzbsv.zzm(obj, j); } /* JADX INFO: Access modifiers changed from: package-private */ public static void zza(Object obj, long j, boolean z) { zzbsv.zza(obj, j, z); } /* JADX INFO: Access modifiers changed from: package-private */ public static float zzn(Object obj, long j) { return zzbsv.zzn(obj, j); } /* JADX INFO: Access modifiers changed from: package-private */ public static void zza(Object obj, long j, float f) { zzbsv.zza(obj, j, f); } /* JADX INFO: Access modifiers changed from: package-private */ public static double zzo(Object obj, long j) { return zzbsv.zzo(obj, j); } /* JADX INFO: Access modifiers changed from: package-private */ public static void zza(Object obj, long j, double d) { zzbsv.zza(obj, j, d); } /* JADX INFO: Access modifiers changed from: package-private */ public static Object zzp(Object obj, long j) { return zzbsv.zzbtm.getObject(obj, j); } /* JADX INFO: Access modifiers changed from: package-private */ public static void zza(Object obj, long j, Object obj2) { zzbsv.zzbtm.putObject(obj, j, obj2); } /* JADX INFO: Access modifiers changed from: package-private */ public static byte zza(byte[] bArr, long j) { return zzbsv.zzy(bArr, zzbsx + j); } /* JADX INFO: Access modifiers changed from: package-private */ public static void zza(byte[] bArr, long j, byte b) { zzbsv.zze(bArr, zzbsx + j, b); } /* JADX INFO: Access modifiers changed from: package-private */ public static Unsafe zztl() { try { return (Unsafe) AccessController.doPrivileged(new zzxd()); } catch (Throwable unused) { return null; } } private static boolean zztm() { Unsafe unsafe = zzbqw; if (unsafe == null) { return false; } try { Class cls = unsafe.getClass(); cls.getMethod("objectFieldOffset", Field.class); cls.getMethod("arrayBaseOffset", Class.class); cls.getMethod("arrayIndexScale", Class.class); cls.getMethod("getInt", Object.class, Long.TYPE); cls.getMethod("putInt", Object.class, Long.TYPE, Integer.TYPE); cls.getMethod("getLong", Object.class, Long.TYPE); cls.getMethod("putLong", Object.class, Long.TYPE, Long.TYPE); cls.getMethod("getObject", Object.class, Long.TYPE); cls.getMethod("putObject", Object.class, Long.TYPE, Object.class); if (zzsr.zzpv()) { return true; } cls.getMethod("getByte", Object.class, Long.TYPE); cls.getMethod("putByte", Object.class, Long.TYPE, Byte.TYPE); cls.getMethod("getBoolean", Object.class, Long.TYPE); cls.getMethod("putBoolean", Object.class, Long.TYPE, Boolean.TYPE); cls.getMethod("getFloat", Object.class, Long.TYPE); cls.getMethod("putFloat", Object.class, Long.TYPE, Float.TYPE); cls.getMethod("getDouble", Object.class, Long.TYPE); cls.getMethod("putDouble", Object.class, Long.TYPE, Double.TYPE); return true; } catch (Throwable th) { Logger logger2 = logger; Level level = Level.WARNING; String valueOf = String.valueOf(th); StringBuilder sb = new StringBuilder(String.valueOf(valueOf).length() + 71); sb.append("platform method missing - proto runtime falling back to safer methods: "); sb.append(valueOf); logger2.logp(level, "o.vqr", "supportsUnsafeArrayOperations", sb.toString()); return false; } } private static boolean zztn() { Unsafe unsafe = zzbqw; if (unsafe == null) { return false; } try { Class cls = unsafe.getClass(); cls.getMethod("objectFieldOffset", Field.class); cls.getMethod("getLong", Object.class, Long.TYPE); if (zzto() == null) { return false; } if (zzsr.zzpv()) { return true; } cls.getMethod("getByte", Long.TYPE); cls.getMethod("putByte", Long.TYPE, Byte.TYPE); cls.getMethod("getInt", Long.TYPE); cls.getMethod("putInt", Long.TYPE, Integer.TYPE); cls.getMethod("getLong", Long.TYPE); cls.getMethod("putLong", Long.TYPE, Long.TYPE); cls.getMethod("copyMemory", Long.TYPE, Long.TYPE, Long.TYPE); cls.getMethod("copyMemory", Object.class, Long.TYPE, Object.class, Long.TYPE, Long.TYPE); return true; } catch (Throwable th) { Logger logger2 = logger; Level level = Level.WARNING; String valueOf = String.valueOf(th); StringBuilder sb = new StringBuilder(String.valueOf(valueOf).length() + 71); sb.append("platform method missing - proto runtime falling back to safer methods: "); sb.append(valueOf); logger2.logp(level, "o.vqr", "supportsUnsafeByteBufferOperations", sb.toString()); return false; } } private static boolean zzp(Class cls) { if (!zzsr.zzpv()) { return false; } try { Class cls2 = zzbke; cls2.getMethod("peekLong", cls, Boolean.TYPE); cls2.getMethod("pokeLong", cls, Long.TYPE, Boolean.TYPE); cls2.getMethod("pokeInt", cls, Integer.TYPE, Boolean.TYPE); cls2.getMethod("peekInt", cls, Boolean.TYPE); cls2.getMethod("pokeByte", cls, Byte.TYPE); cls2.getMethod("peekByte", cls); cls2.getMethod("pokeByteArray", cls, byte[].class, Integer.TYPE, Integer.TYPE); cls2.getMethod("peekByteArray", cls, byte[].class, Integer.TYPE, Integer.TYPE); return true; } catch (Throwable unused) { return false; } } private static Field zzto() { Field zzb2; if (zzsr.zzpv() && (zzb2 = zzb(Buffer.class, "effectiveDirectAddress")) != null) { return zzb2; } Field zzb3 = zzb(Buffer.class, PlaceTypes.ADDRESS); if (zzb3 == null || zzb3.getType() != Long.TYPE) { return null; } return zzb3; } private static Field zzb(Class cls, String str) { try { return cls.getDeclaredField(str); } catch (Throwable unused) { return null; } } /* JADX INFO: Access modifiers changed from: private */ public static byte zzq(Object obj, long j) { return (byte) (zzk(obj, (-4) & j) >>> ((int) (((~j) & 3) << 3))); } /* JADX INFO: Access modifiers changed from: private */ public static byte zzr(Object obj, long j) { return (byte) (zzk(obj, (-4) & j) >>> ((int) ((j & 3) << 3))); } /* JADX INFO: Access modifiers changed from: private */ public static void zza(Object obj, long j, byte b) { long j2 = (-4) & j; int zzk = zzk(obj, j2); int i = ((~((int) j)) & 3) << 3; zza(obj, j2, ((~(255 << i)) & zzk) | ((b & UnsignedBytes.MAX_VALUE) << i)); } /* JADX INFO: Access modifiers changed from: private */ public static void zzb(Object obj, long j, byte b) { long j2 = (-4) & j; int zzk = zzk(obj, j2); int i = (((int) j) & 3) << 3; zza(obj, j2, ((~(255 << i)) & zzk) | ((b & UnsignedBytes.MAX_VALUE) << i)); } /* JADX INFO: Access modifiers changed from: private */ public static boolean zzs(Object obj, long j) { return zzq(obj, j) != 0; } /* JADX INFO: Access modifiers changed from: private */ public static boolean zzt(Object obj, long j) { return zzr(obj, j) != 0; } /* JADX INFO: Access modifiers changed from: private */ public static void zzb(Object obj, long j, boolean z) { zza(obj, j, z ? (byte) 1 : (byte) 0); } /* JADX INFO: Access modifiers changed from: private */ public static void zzc(Object obj, long j, boolean z) { zzb(obj, j, z ? (byte) 1 : (byte) 0); } /* JADX WARN: Removed duplicated region for block: B:13:0x00dd */ /* JADX WARN: Removed duplicated region for block: B:17:0x00df */ static { /* java.lang.Class r0 = com.google.android.gms.internal.firebase_ml.zzxc.class java.lang.String r0 = r0.getName() java.util.logging.Logger r0 = java.util.logging.Logger.getLogger(r0) com.google.android.gms.internal.firebase_ml.zzxc.logger = r0 sun.misc.Unsafe r0 = zztl() com.google.android.gms.internal.firebase_ml.zzxc.zzbqw = r0 java.lang.Class r1 = com.google.android.gms.internal.firebase_ml.zzsr.zzpw() com.google.android.gms.internal.firebase_ml.zzxc.zzbke = r1 java.lang.Class r1 = java.lang.Long.TYPE boolean r1 = zzp(r1) com.google.android.gms.internal.firebase_ml.zzxc.zzbst = r1 java.lang.Class r2 = java.lang.Integer.TYPE boolean r2 = zzp(r2) com.google.android.gms.internal.firebase_ml.zzxc.zzbsu = r2 if (r0 != 0) goto L2b goto L41 L2b: boolean r3 = com.google.android.gms.internal.firebase_ml.zzsr.zzpv() if (r3 == 0) goto L43 if (r1 == 0) goto L39 com.google.android.gms.internal.firebase_ml.zzxc$zzb r1 = new com.google.android.gms.internal.firebase_ml.zzxc$zzb r1.(r0) goto L48 L39: if (r2 == 0) goto L41 com.google.android.gms.internal.firebase_ml.zzxc$zza r1 = new com.google.android.gms.internal.firebase_ml.zzxc$zza r1.(r0) goto L48 L41: r1 = 0 goto L48 L43: com.google.android.gms.internal.firebase_ml.zzxc$zzc r1 = new com.google.android.gms.internal.firebase_ml.zzxc$zzc r1.(r0) L48: com.google.android.gms.internal.firebase_ml.zzxc.zzbsv = r1 boolean r0 = zztn() com.google.android.gms.internal.firebase_ml.zzxc.zzbsw = r0 boolean r0 = zztm() com.google.android.gms.internal.firebase_ml.zzxc.zzbkz = r0 java.lang.Class r0 = byte[].class int r0 = zzn(r0) long r2 = (long) r0 com.google.android.gms.internal.firebase_ml.zzxc.zzbsx = r2 java.lang.Class r0 = boolean[].class int r2 = zzn(r0) long r2 = (long) r2 com.google.android.gms.internal.firebase_ml.zzxc.zzbsy = r2 int r0 = zzo(r0) long r2 = (long) r0 com.google.android.gms.internal.firebase_ml.zzxc.zzbsz = r2 java.lang.Class r0 = int[].class int r2 = zzn(r0) long r2 = (long) r2 com.google.android.gms.internal.firebase_ml.zzxc.zzbta = r2 int r0 = zzo(r0) long r2 = (long) r0 com.google.android.gms.internal.firebase_ml.zzxc.zzbtb = r2 java.lang.Class r0 = long[].class int r2 = zzn(r0) long r2 = (long) r2 com.google.android.gms.internal.firebase_ml.zzxc.zzbtc = r2 int r0 = zzo(r0) long r2 = (long) r0 com.google.android.gms.internal.firebase_ml.zzxc.zzbtd = r2 java.lang.Class r0 = float[].class int r2 = zzn(r0) long r2 = (long) r2 com.google.android.gms.internal.firebase_ml.zzxc.zzbte = r2 int r0 = zzo(r0) long r2 = (long) r0 com.google.android.gms.internal.firebase_ml.zzxc.zzbtf = r2 java.lang.Class r0 = double[].class int r2 = zzn(r0) long r2 = (long) r2 com.google.android.gms.internal.firebase_ml.zzxc.zzbtg = r2 int r0 = zzo(r0) long r2 = (long) r0 com.google.android.gms.internal.firebase_ml.zzxc.zzbth = r2 java.lang.Class r0 = java.lang.Object[].class int r0 = zzn(r0) long r2 = (long) r0 com.google.android.gms.internal.firebase_ml.zzxc.zzbti = r2 java.lang.Class r0 = java.lang.Object[].class int r0 = zzo(r0) long r2 = (long) r0 com.google.android.gms.internal.firebase_ml.zzxc.zzbtj = r2 java.lang.reflect.Field r0 = zzto() if (r0 == 0) goto Ld1 if (r1 != 0) goto Lca goto Ld1 Lca: sun.misc.Unsafe r1 = r1.zzbtm long r0 = r1.objectFieldOffset(r0) goto Ld3 Ld1: r0 = -1 Ld3: com.google.android.gms.internal.firebase_ml.zzxc.zzbtk = r0 java.nio.ByteOrder r0 = java.nio.ByteOrder.nativeOrder() java.nio.ByteOrder r1 = java.nio.ByteOrder.BIG_ENDIAN if (r0 != r1) goto Ldf r0 = 1 goto Le0 Ldf: r0 = 0 Le0: com.google.android.gms.internal.firebase_ml.zzxc.zzbtl = r0 return */ throw new UnsupportedOperationException("Method not decompiled: com.google.android.gms.internal.firebase_ml.zzxc.():void"); } /* JADX INFO: Access modifiers changed from: package-private */ public static boolean zztk() { return zzbsw; } /* JADX INFO: Access modifiers changed from: package-private */ public static boolean zztj() { return zzbkz; } }