g.java 源代码
package q5;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Ordering;
import com.google.common.primitives.Ints;
import com.umeng.analytics.pro.n;
import d5.a;
import d5.b;
import g5.a0;
import g5.b0;
import g5.c0;
import g5.d0;
import g5.e0;
import g5.f0;
import g5.g0;
import g5.h0;
import g5.i0;
import g5.j0;
import g5.w;
import g5.x;
import g5.y;
import g5.z;
import h5.a;
import h5.b;
import h5.c;
import h5.d;
import h5.e;
import h5.g;
import h5.h;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.lang.CharSequence;
import java.lang.Comparable;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.zip.Adler32;
import q5.a;
import q5.b;
import q5.c;
import q5.d;
import q5.h;
import q5.j;
import q5.m;
import q5.n;
import q5.r;
import q5.s;
import q5.t;
import q5.u;
import w4.v;
public abstract class g<StringKey extends CharSequence, StringRef extends h5.g, TypeKey extends CharSequence, TypeRef extends h5.h, ProtoRefKey extends h5.d, FieldRefKey extends h5.b, MethodRefKey extends h5.e, ClassKey extends Comparable<? super ClassKey>, CallSiteKey extends h5.a, MethodHandleKey extends h5.c, AnnotationKey extends d5.a, AnnotationSetKey, TypeListKey, FieldKey, MethodKey, EncodedArrayKey, EncodedValue, AnnotationElement extends d5.b, StringSectionType extends s<StringKey, StringRef>, TypeSectionType extends u<StringKey, TypeKey, TypeRef>, ProtoSectionType extends r<StringKey, TypeKey, ProtoRefKey, TypeListKey>, FieldSectionType extends j<StringKey, TypeKey, FieldRefKey, FieldKey>, MethodSectionType extends n<StringKey, TypeKey, ProtoRefKey, MethodRefKey, MethodKey>, ClassSectionType extends q5.d<StringKey, TypeKey, TypeListKey, ClassKey, FieldKey, MethodKey, AnnotationSetKey, EncodedArrayKey>, CallSiteSectionType extends q5.c<CallSiteKey, EncodedArrayKey>, MethodHandleSectionType extends m<MethodHandleKey, FieldRefKey, MethodRefKey>, TypeListSectionType extends t<TypeKey, TypeListKey>, AnnotationSectionType extends q5.a<StringKey, TypeKey, AnnotationKey, AnnotationElement, EncodedValue>, AnnotationSetSectionType extends q5.b<AnnotationKey, AnnotationSetKey>, EncodedArraySectionType extends q5.h<EncodedArrayKey, EncodedValue>> {
private static Comparator<Map.Entry> P = new b();
public final StringSectionType B;
public final TypeSectionType C;
public final ProtoSectionType D;
public final FieldSectionType E;
public final MethodSectionType F;
public final ClassSectionType G;
public final CallSiteSectionType H;
public final MethodHandleSectionType I;
public final TypeListSectionType J;
public final AnnotationSectionType K;
public final AnnotationSetSectionType L;
public final EncodedArraySectionType M;
private final k<?>[] N;
protected final o4.h f25752a;
protected int f25753b = 0;
protected int f25754c = 0;
protected int f25755d = 0;
protected int f25756e = 0;
protected int f25757f = 0;
protected int f25758g = 0;
protected int f25759h = 0;
protected int f25760i = 0;
protected int f25761j = 0;
protected int f25762k = 0;
protected int f25763l = 0;
protected int f25764m = 0;
protected int f25765n = 0;
protected int f25766o = 0;
protected int f25767p = 0;
protected int f25768q = 0;
protected int f25769r = 0;
protected int f25770s = 0;
protected int f25771t = 0;
protected int f25772u = 0;
protected boolean f25773v = false;
protected int f25774w = 0;
protected int f25775x = 0;
protected int f25776y = 0;
protected int f25777z = 0;
protected int A = 0;
private Comparator<Map.Entry<? extends CallSiteKey, Integer>> O = new a();
public class a implements Comparator<Map.Entry<? extends CallSiteKey, Integer>> {
a() {
}
@Override
public int compare(Map.Entry<? extends CallSiteKey, Integer> entry, Map.Entry<? extends CallSiteKey, Integer> entry2) {
g gVar = g.this;
int R = gVar.M.R(gVar.H.o(entry.getKey()));
g gVar2 = g.this;
return Ints.a(R, gVar2.M.R(gVar2.H.o(entry2.getKey())));
}
}
static class b implements Comparator<Map.Entry> {
b() {
}
@Override
public int compare(Map.Entry entry, Map.Entry entry2) {
return entry.getKey().toString().compareTo(entry2.getKey().toString());
}
}
public static class c<T> implements Comparator<Map.Entry<? extends T, ?>> {
c() {
}
@Override
public int compare(Map.Entry<? extends T, ?> entry, Map.Entry<? extends T, ?> entry2) {
return ((Comparable) entry.getKey()).compareTo(entry2.getKey());
}
}
public static class d {
static final int[] f25779a;
static {
int[] iArr = new int[o4.d.values().length];
f25779a = iArr;
try {
iArr[o4.d.Format10t.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
f25779a[o4.d.Format10x.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
f25779a[o4.d.Format11n.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
try {
f25779a[o4.d.Format11x.ordinal()] = 4;
} catch (NoSuchFieldError unused4) {
}
try {
f25779a[o4.d.Format12x.ordinal()] = 5;
} catch (NoSuchFieldError unused5) {
}
try {
f25779a[o4.d.Format20bc.ordinal()] = 6;
} catch (NoSuchFieldError unused6) {
}
try {
f25779a[o4.d.Format20t.ordinal()] = 7;
} catch (NoSuchFieldError unused7) {
}
try {
f25779a[o4.d.Format21c.ordinal()] = 8;
} catch (NoSuchFieldError unused8) {
}
try {
f25779a[o4.d.Format21ih.ordinal()] = 9;
} catch (NoSuchFieldError unused9) {
}
try {
f25779a[o4.d.Format21lh.ordinal()] = 10;
} catch (NoSuchFieldError unused10) {
}
try {
f25779a[o4.d.Format21s.ordinal()] = 11;
} catch (NoSuchFieldError unused11) {
}
try {
f25779a[o4.d.Format21t.ordinal()] = 12;
} catch (NoSuchFieldError unused12) {
}
try {
f25779a[o4.d.Format22b.ordinal()] = 13;
} catch (NoSuchFieldError unused13) {
}
try {
f25779a[o4.d.Format22c.ordinal()] = 14;
} catch (NoSuchFieldError unused14) {
}
try {
f25779a[o4.d.Format22cs.ordinal()] = 15;
} catch (NoSuchFieldError unused15) {
}
try {
f25779a[o4.d.Format22s.ordinal()] = 16;
} catch (NoSuchFieldError unused16) {
}
try {
f25779a[o4.d.Format22t.ordinal()] = 17;
} catch (NoSuchFieldError unused17) {
}
try {
f25779a[o4.d.Format22x.ordinal()] = 18;
} catch (NoSuchFieldError unused18) {
}
try {
f25779a[o4.d.Format23x.ordinal()] = 19;
} catch (NoSuchFieldError unused19) {
}
try {
f25779a[o4.d.Format30t.ordinal()] = 20;
} catch (NoSuchFieldError unused20) {
}
try {
f25779a[o4.d.Format31c.ordinal()] = 21;
} catch (NoSuchFieldError unused21) {
}
try {
f25779a[o4.d.Format31i.ordinal()] = 22;
} catch (NoSuchFieldError unused22) {
}
try {
f25779a[o4.d.Format31t.ordinal()] = 23;
} catch (NoSuchFieldError unused23) {
}
try {
f25779a[o4.d.Format32x.ordinal()] = 24;
} catch (NoSuchFieldError unused24) {
}
try {
f25779a[o4.d.Format35c.ordinal()] = 25;
} catch (NoSuchFieldError unused25) {
}
try {
f25779a[o4.d.Format35mi.ordinal()] = 26;
} catch (NoSuchFieldError unused26) {
}
try {
f25779a[o4.d.Format35ms.ordinal()] = 27;
} catch (NoSuchFieldError unused27) {
}
try {
f25779a[o4.d.Format3rc.ordinal()] = 28;
} catch (NoSuchFieldError unused28) {
}
try {
f25779a[o4.d.Format3rmi.ordinal()] = 29;
} catch (NoSuchFieldError unused29) {
}
try {
f25779a[o4.d.Format3rms.ordinal()] = 30;
} catch (NoSuchFieldError unused30) {
}
try {
f25779a[o4.d.Format45cc.ordinal()] = 31;
} catch (NoSuchFieldError unused31) {
}
try {
f25779a[o4.d.Format4rcc.ordinal()] = 32;
} catch (NoSuchFieldError unused32) {
}
try {
f25779a[o4.d.Format51l.ordinal()] = 33;
} catch (NoSuchFieldError unused33) {
}
try {
f25779a[o4.d.ArrayPayload.ordinal()] = 34;
} catch (NoSuchFieldError unused34) {
}
try {
f25779a[o4.d.PackedSwitchPayload.ordinal()] = 35;
} catch (NoSuchFieldError unused35) {
}
try {
f25779a[o4.d.SparseSwitchPayload.ordinal()] = 36;
} catch (NoSuchFieldError unused36) {
}
}
}
public static class e<MethodKey> {
MethodKey f25780a;
int f25781b;
e(Object obj, int i6, a aVar) {
this(obj, i6);
}
private e(MethodKey methodkey, int i6) {
this.f25781b = i6;
this.f25780a = methodkey;
}
}
public class f extends i<StringKey, TypeKey, FieldRefKey, MethodRefKey, AnnotationElement, ProtoRefKey, MethodHandleKey, EncodedValue> {
f(g gVar, q5.f fVar, a aVar) {
this(fVar);
}
@Override
protected void g(EncodedValue encodedvalue) throws IOException {
g.this.y(this, encodedvalue);
}
private f(q5.f fVar) {
super(fVar, g.this.B, g.this.C, g.this.E, g.this.F, g.this.D, g.this.I, g.this.K);
}
}
public static class C0327g {
private final int f25783a;
private final s5.c f25784b;
private final q5.f f25785c;
private final q5.f f25786d;
private boolean f25787e = false;
private int f25788f = 0;
public C0327g(s5.c cVar, q5.f fVar, int i6) throws IOException {
this.f25783a = fVar.getPosition();
this.f25784b = cVar;
this.f25786d = fVar;
int i7 = i6 * 4;
fVar.k(0);
this.f25785c = g.g(cVar, fVar.getPosition());
for (int i8 = 0; i8 < i7; i8++) {
this.f25786d.write(0);
}
this.f25786d.flush();
}
private void a() throws IOException {
if (this.f25787e) {
this.f25786d.u(o4.e.WHITELIST.getValue());
} else {
this.f25788f++;
}
}
public void b() throws IOException {
this.f25785c.close();
q5.f fVar = null;
try {
fVar = g.g(this.f25784b, this.f25783a);
fVar.k(this.f25786d.getPosition() - this.f25783a);
fVar.close();
} catch (Throwable th) {
if (fVar != null) {
fVar.close();
}
throw th;
}
}
public void c() throws IOException {
if (!this.f25787e) {
this.f25785c.k(0);
}
this.f25787e = false;
this.f25788f = 0;
}
public void d(Set<o4.e> set) throws IOException {
if (set.isEmpty()) {
a();
return;
}
if (!this.f25787e) {
this.f25787e = true;
this.f25785c.k(this.f25786d.getPosition() - this.f25783a);
for (int i6 = 0; i6 < this.f25788f; i6++) {
this.f25786d.u(o4.e.WHITELIST.getValue());
}
this.f25788f = 0;
}
this.f25786d.u(o4.e.a(set));
}
}
public abstract class h {
public h() {
}
public abstract AnnotationSectionType a();
public abstract AnnotationSetSectionType b();
public abstract CallSiteSectionType c();
public abstract ClassSectionType d();
public abstract EncodedArraySectionType e();
public abstract FieldSectionType f();
public abstract MethodHandleSectionType g();
public abstract MethodSectionType h();
public abstract ProtoSectionType i();
public abstract StringSectionType j();
public abstract TypeListSectionType k();
public abstract TypeSectionType l();
}
public g(o4.h hVar) {
this.f25752a = hVar;
g<StringKey, StringRef, TypeKey, TypeRef, ProtoRefKey, FieldRefKey, MethodRefKey, ClassKey, CallSiteKey, MethodHandleKey, AnnotationKey, AnnotationSetKey, TypeListKey, FieldKey, MethodKey, EncodedArrayKey, EncodedValue, AnnotationElement, StringSectionType, TypeSectionType, ProtoSectionType, FieldSectionType, MethodSectionType, ClassSectionType, CallSiteSectionType, MethodHandleSectionType, TypeListSectionType, AnnotationSectionType, AnnotationSetSectionType, EncodedArraySectionType>.h f6 = f();
this.B = (StringSectionType) f6.j();
TypeSectionType typesectiontype = (TypeSectionType) f6.l();
this.C = typesectiontype;
ProtoSectionType protosectiontype = (ProtoSectionType) f6.i();
this.D = protosectiontype;
FieldSectionType fieldsectiontype = (FieldSectionType) f6.f();
this.E = fieldsectiontype;
MethodSectionType methodsectiontype = (MethodSectionType) f6.h();
this.F = methodsectiontype;
this.G = (ClassSectionType) f6.d();
CallSiteSectionType callsitesectiontype = (CallSiteSectionType) f6.c();
this.H = callsitesectiontype;
MethodHandleSectionType methodhandlesectiontype = (MethodHandleSectionType) f6.g();
this.I = methodhandlesectiontype;
this.J = (TypeListSectionType) f6.k();
this.K = (AnnotationSectionType) f6.a();
this.L = (AnnotationSetSectionType) f6.b();
this.M = (EncodedArraySectionType) f6.e();
this.N = new k[]{typesectiontype, protosectiontype, fieldsectiontype, methodsectiontype, callsitesectiontype, methodhandlesectiontype};
}
private void A(q5.f fVar, int i6, int i7) throws IOException {
fVar.write(z4.c.b(this.f25752a.f24965a));
fVar.k(0);
fVar.write(new byte[20]);
fVar.k(i7);
fVar.k(112);
fVar.k(305419896);
fVar.k(0);
fVar.k(0);
fVar.k(this.f25772u);
G(fVar, this.B.b().size(), this.f25753b);
G(fVar, this.C.b().size(), this.f25754c);
G(fVar, this.D.b().size(), this.f25755d);
G(fVar, this.E.b().size(), this.f25756e);
G(fVar, this.F.b().size(), this.f25757f);
G(fVar, this.G.b().size(), this.f25758g);
fVar.k(i7 - i6);
fVar.k(i6);
}
private void B(q5.f fVar) throws IOException {
fVar.d();
this.f25772u = fVar.getPosition();
fVar.k(b());
C(fVar, 0, 1, 0);
C(fVar, 1, this.B.b().size(), this.f25753b);
C(fVar, 2, this.C.b().size(), this.f25754c);
C(fVar, 3, this.D.b().size(), this.f25755d);
C(fVar, 4, this.E.b().size(), this.f25756e);
C(fVar, 5, this.F.b().size(), this.f25757f);
C(fVar, 6, this.G.b().size(), this.f25758g);
C(fVar, 7, this.H.b().size(), this.f25759h);
C(fVar, 8, this.I.b().size(), this.f25760i);
C(fVar, 8194, this.B.b().size(), this.f25761j);
C(fVar, 4097, this.J.b().size(), this.f25763l);
C(fVar, n.a.f20825t, this.M.b().size(), this.f25764m);
C(fVar, n.a.f20824s, this.K.b().size(), this.f25765n);
C(fVar, 4099, this.L.b().size() + (h() ? 1 : 0), this.f25766o);
C(fVar, 4098, this.f25774w, this.f25767p);
C(fVar, 8198, this.f25775x, this.f25768q);
C(fVar, n.a.f20823r, this.f25776y, this.f25769r);
C(fVar, n.a.f20821p, this.f25777z, this.f25770s);
C(fVar, 8192, this.A, this.f25762k);
if (i()) {
C(fVar, 61440, 1, this.f25771t);
}
C(fVar, 4096, 1, this.f25772u);
}
private void C(q5.f fVar, int i6, int i7, int i8) throws IOException {
if (i7 > 0) {
fVar.w(i6);
fVar.w(0);
fVar.k(i7);
fVar.k(i8);
}
}
private void D(q5.f fVar) throws IOException {
int j02;
this.f25760i = fVar.getPosition();
int i6 = 0;
for (Map.Entry entry : this.I.b()) {
int i7 = i6 + 1;
entry.setValue(Integer.valueOf(i6));
h5.c cVar = (h5.c) entry.getKey();
fVar.w(cVar.h0());
fVar.w(0);
switch (cVar.h0()) {
case 0:
case 1:
case 2:
case 3:
j02 = this.E.j0(this.I.p(cVar));
break;
case 4:
case 5:
case 6:
case 7:
case 8:
j02 = this.F.j0(this.I.U(cVar));
break;
default:
throw new v5.g("Invalid method handle type: %d", Integer.valueOf(cVar.h0()));
}
fVar.w(j02);
fVar.w(0);
i6 = i7;
}
}
private void E(q5.f fVar) throws IOException {
this.f25757f = fVar.getPosition();
ArrayList<Map.Entry> h6 = Lists.h(this.F.b());
Collections.sort(h6, c());
int i6 = 0;
for (Map.Entry entry : h6) {
int i7 = i6 + 1;
entry.setValue(Integer.valueOf(i6));
h5.e eVar = (h5.e) entry.getKey();
fVar.w(this.C.j0(this.F.Z(eVar)));
fVar.w(this.D.j0(this.F.N(eVar)));
fVar.k(this.B.j0(this.F.M(eVar)));
i6 = i7;
}
}
private void F(q5.f fVar) throws IOException {
this.f25755d = fVar.getPosition();
ArrayList<Map.Entry> h6 = Lists.h(this.D.b());
Collections.sort(h6, c());
int i6 = 0;
for (Map.Entry entry : h6) {
int i7 = i6 + 1;
entry.setValue(Integer.valueOf(i6));
h5.d dVar = (h5.d) entry.getKey();
fVar.k(this.B.j0(this.D.i(dVar)));
fVar.k(this.C.j0(this.D.C(dVar)));
fVar.k(this.J.a(this.D.d0(dVar)));
i6 = i7;
}
}
private void G(q5.f fVar, int i6, int i7) throws IOException {
fVar.k(i6);
if (i6 > 0) {
fVar.k(i7);
} else {
fVar.k(0);
}
}
private void H(q5.f fVar, q5.f fVar2) throws IOException {
this.f25753b = fVar.getPosition();
this.f25761j = fVar2.getPosition();
ArrayList<Map.Entry> h6 = Lists.h(this.B.b());
Collections.sort(h6, P);
int i6 = 0;
for (Map.Entry entry : h6) {
int i7 = i6 + 1;
entry.setValue(Integer.valueOf(i6));
fVar.k(fVar2.getPosition());
String charSequence = ((CharSequence) entry.getKey()).toString();
fVar2.u(charSequence.length());
fVar2.s(charSequence);
fVar2.write(0);
i6 = i7;
}
}
private void K(q5.f fVar) throws IOException {
fVar.d();
this.f25763l = fVar.getPosition();
for (Map.Entry entry : this.J.b()) {
fVar.d();
entry.setValue(Integer.valueOf(fVar.getPosition()));
Collection q6 = this.J.q(entry.getKey());
fVar.k(q6.size());
Iterator it = q6.iterator();
while (it.hasNext()) {
fVar.w(this.C.j0((CharSequence) it.next()));
}
}
}
private void L(q5.f fVar) throws IOException {
this.f25754c = fVar.getPosition();
ArrayList<Map.Entry> h6 = Lists.h(this.C.b());
Collections.sort(h6, P);
int i6 = 0;
for (Map.Entry entry : h6) {
entry.setValue(Integer.valueOf(i6));
fVar.k(this.B.j0(this.C.k(entry.getKey())));
i6++;
}
}
private int b() {
int i6;
if (this.B.b().size() > 0) {
i6 = 3;
} else {
i6 = 1;
}
if (this.C.b().size() > 0) {
i6++;
}
if (this.D.b().size() > 0) {
i6++;
}
if (this.E.b().size() > 0) {
i6++;
}
if (this.F.b().size() > 0) {
i6++;
}
if (this.H.b().size() > 0) {
i6++;
}
if (this.I.b().size() > 0) {
i6++;
}
if (this.J.b().size() > 0) {
i6++;
}
if (this.M.b().size() > 0) {
i6++;
}
if (this.K.b().size() > 0) {
i6++;
}
if (this.L.b().size() > 0 || h()) {
i6++;
}
if (this.f25774w > 0) {
i6++;
}
if (this.f25775x > 0) {
i6++;
}
if (this.f25776y > 0) {
i6++;
}
if (this.f25777z > 0) {
i6++;
}
if (this.G.b().size() > 0) {
i6++;
}
if (this.A > 0) {
i6++;
}
if (i()) {
i6++;
}
return i6 + 1;
}
private static <T extends Comparable<? super T>> Comparator<Map.Entry<? extends T, ?>> c() {
return new c();
}
private void d(u4.n nVar) {
List<u4.c> b6 = nVar.b();
for (int i6 = 0; i6 < b6.size(); i6++) {
f5.f fVar = b6.get(i6);
if (fVar.m() == o4.g.X) {
f5.j jVar = (f5.j) fVar;
if (this.B.j0((h5.g) jVar.d()) >= 65536) {
nVar.d0(i6, new v(o4.g.Y, ((f5.i) fVar).k(), jVar.d()));
}
}
}
}
private int e() {
return (this.B.a0() * 4) + 112 + (this.C.a0() * 4) + (this.D.a0() * 12) + (this.E.a0() * 8) + (this.F.a0() * 8) + (this.G.a0() * 32) + (this.H.a0() * 4) + (this.I.a0() * 8);
}
public static q5.f g(s5.c cVar, int i6) throws IOException {
return new q5.f(cVar.b(i6), i6);
}
private boolean h() {
if (this.f25752a.f24965a < 17) {
return true;
}
return false;
}
private boolean i() {
if (this.f25773v && this.f25752a.f24965a >= 29) {
return true;
}
return false;
}
private void j(s5.c cVar) throws IOException {
Adler32 adler32 = new Adler32();
byte[] bArr = new byte[4096];
InputStream a7 = cVar.a(12);
for (int read = a7.read(bArr); read >= 0; read = a7.read(bArr)) {
adler32.update(bArr, 0, read);
}
OutputStream b6 = cVar.b(8);
q5.f.l(b6, (int) adler32.getValue());
b6.close();
}
private void k(s5.c cVar) throws IOException {
try {
MessageDigest messageDigest = MessageDigest.getInstance("SHA-1");
byte[] bArr = new byte[4096];
InputStream a7 = cVar.a(32);
for (int read = a7.read(bArr); read >= 0; read = a7.read(bArr)) {
messageDigest.update(bArr, 0, read);
}
byte[] digest = messageDigest.digest();
if (digest.length == 20) {
OutputStream b6 = cVar.b(12);
b6.write(digest);
b6.close();
} else {
throw new RuntimeException("unexpected digest write: " + digest.length + " bytes");
}
} catch (NoSuchAlgorithmException e6) {
throw new RuntimeException(e6);
}
}
private void l(q5.f fVar) throws IOException {
fVar.d();
this.f25768q = fVar.getPosition();
HashMap h6 = Maps.h();
ByteBuffer allocate = ByteBuffer.allocate(65536);
allocate.order(ByteOrder.LITTLE_ENDIAN);
for (Comparable comparable : this.G.A()) {
Collection<? extends FieldKey> p02 = this.G.p0(comparable);
Collection<? extends MethodKey> K = this.G.K(comparable);
int size = (p02.size() * 8) + (K.size() * 16);
if (size > allocate.capacity()) {
allocate = ByteBuffer.allocate(size);
allocate.order(ByteOrder.LITTLE_ENDIAN);
}
allocate.clear();
int i6 = 0;
for (FieldKey fieldkey : p02) {
Object k02 = this.G.k0(fieldkey);
if (k02 != null) {
i6++;
allocate.putInt(this.E.B(fieldkey));
allocate.putInt(this.L.R(k02));
}
}
int i7 = 0;
for (MethodKey methodkey : K) {
Object c6 = this.G.c(methodkey);
if (c6 != null) {
i7++;
allocate.putInt(this.F.Q(methodkey));
allocate.putInt(this.L.R(c6));
}
}
int i8 = 0;
for (MethodKey methodkey2 : K) {
int i02 = this.G.i0(methodkey2);
if (i02 != 0) {
i8++;
allocate.putInt(this.F.Q(methodkey2));
allocate.putInt(i02);
}
}
Object o02 = this.G.o0(comparable);
if (i6 == 0 && i7 == 0 && i8 == 0) {
if (o02 != null) {
Integer num = (Integer) h6.get(o02);
if (num != null) {
this.G.f0(comparable, num.intValue());
} else {
h6.put(o02, Integer.valueOf(fVar.getPosition()));
}
}
}
this.f25775x++;
this.G.f0(comparable, fVar.getPosition());
fVar.k(this.L.a(o02));
fVar.k(i6);
fVar.k(i7);
fVar.k(i8);
fVar.write(allocate.array(), 0, allocate.position());
}
}
private void m(q5.f fVar) throws IOException {
fVar.d();
this.f25767p = fVar.getPosition();
HashMap h6 = Maps.h();
Iterator it = this.G.A().iterator();
while (it.hasNext()) {
for (MethodKey methodkey : this.G.K((Comparable) it.next())) {
List<? extends AnnotationSetKey> u6 = this.G.u(methodkey);
if (u6 != null) {
Integer num = (Integer) h6.get(u6);
if (num != null) {
this.G.e0(methodkey, num.intValue());
} else {
fVar.d();
int position = fVar.getPosition();
this.G.e0(methodkey, position);
h6.put(u6, Integer.valueOf(position));
this.f25774w++;
fVar.k(u6.size());
for (AnnotationSetKey annotationsetkey : u6) {
if (this.L.S(annotationsetkey).size() > 0) {
fVar.k(this.L.R(annotationsetkey));
} else if (h()) {
fVar.k(this.f25766o);
} else {
fVar.k(0);
}
}
}
}
}
}
}
private void n(q5.f fVar) throws IOException {
fVar.d();
this.f25766o = fVar.getPosition();
if (h()) {
fVar.k(0);
}
for (Map.Entry entry : this.L.b()) {
ImmutableList b6 = Ordering.a(r4.a.f25948q).b(this.L.S(entry.getKey()));
fVar.d();
entry.setValue(Integer.valueOf(fVar.getPosition()));
fVar.k(b6.size());
Iterator<E> it = b6.iterator();
while (it.hasNext()) {
fVar.k(this.K.R((d5.a) it.next()));
}
}
}
private void o(q5.f fVar) throws IOException {
f fVar2 = new f(this, fVar, null);
this.f25765n = fVar.getPosition();
for (Map.Entry entry : this.K.b()) {
entry.setValue(Integer.valueOf(fVar.getPosition()));
d5.a aVar = (d5.a) entry.getKey();
fVar.t(this.K.r(aVar));
fVar.u(this.C.j0(this.K.getType(aVar)));
ImmutableList<d5.b> b6 = Ordering.a(r4.b.f25949q).b(this.K.L(aVar));
fVar.u(b6.size());
for (d5.b bVar : b6) {
fVar.u(this.B.j0(this.K.e(bVar)));
y(fVar2, this.K.b0(bVar));
}
}
}
private void p(q5.f fVar) throws IOException {
this.f25759h = fVar.getPosition();
ArrayList<Map.Entry> h6 = Lists.h(this.H.b());
Collections.sort(h6, this.O);
int i6 = 0;
for (Map.Entry entry : h6) {
entry.setValue(Integer.valueOf(i6));
fVar.k(this.M.R(this.H.o((h5.a) entry.getKey())));
i6++;
}
}
private int q(q5.f fVar, q5.f fVar2, int i6, Map.Entry<? extends ClassKey, Integer> entry) throws IOException {
boolean z6;
if (entry == null) {
return i6;
}
if (entry.getValue().intValue() != -1) {
return i6;
}
ClassKey key = entry.getKey();
entry.setValue(0);
ClassSectionType classsectiontype = this.G;
int q6 = q(fVar, fVar2, i6, classsectiontype.n(classsectiontype.G(key)));
Iterator it = this.J.q(this.G.w(key)).iterator();
while (it.hasNext()) {
q6 = q(fVar, fVar2, q6, this.G.n((CharSequence) it.next()));
}
int i7 = q6 + 1;
entry.setValue(Integer.valueOf(q6));
fVar.k(this.C.j0(this.G.getType(key)));
fVar.k(this.G.Y(key));
fVar.k(this.C.f(this.G.G(key)));
fVar.k(this.J.a(this.G.w(key)));
fVar.k(this.B.f(this.G.d(key)));
fVar.k(this.G.n0(key));
Collection<? extends FieldKey> D = this.G.D(key);
Collection<? extends FieldKey> P2 = this.G.P(key);
Collection<? extends MethodKey> h6 = this.G.h(key);
Collection<? extends MethodKey> g6 = this.G.g(key);
if (D.size() <= 0 && P2.size() <= 0 && h6.size() <= 0 && g6.size() <= 0) {
z6 = false;
} else {
z6 = true;
}
if (z6) {
fVar.k(fVar2.getPosition());
} else {
fVar.k(0);
}
Object J = this.G.J(key);
if (J != null) {
fVar.k(this.M.R(J));
} else {
fVar.k(0);
}
if (z6) {
this.A++;
fVar2.u(D.size());
fVar2.u(P2.size());
fVar2.u(h6.size());
fVar2.u(g6.size());
w(fVar2, D);
w(fVar2, P2);
x(fVar2, h6);
x(fVar2, g6);
}
return i7;
}
private void r(s5.c cVar, q5.f fVar, q5.f fVar2) throws IOException {
this.f25758g = fVar.getPosition();
this.f25762k = fVar2.getPosition();
ArrayList<Map.Entry> h6 = Lists.h(this.G.b());
Collections.sort(h6, c());
Iterator it = h6.iterator();
int i6 = 0;
while (it.hasNext()) {
i6 = q(fVar, fVar2, i6, (Map.Entry) it.next());
}
if (!i()) {
return;
}
this.f25771t = fVar2.getPosition();
C0327g c0327g = new C0327g(cVar, fVar2, h6.size());
try {
for (Map.Entry entry : h6) {
Iterator<? extends FieldKey> it2 = this.G.D(entry.getKey()).iterator();
while (it2.hasNext()) {
c0327g.d(this.G.X(it2.next()));
}
Iterator<? extends FieldKey> it3 = this.G.P(entry.getKey()).iterator();
while (it3.hasNext()) {
c0327g.d(this.G.X(it3.next()));
}
Iterator<? extends MethodKey> it4 = this.G.h(entry.getKey()).iterator();
while (it4.hasNext()) {
c0327g.d(this.G.v(it4.next()));
}
Iterator<? extends MethodKey> it5 = this.G.g(entry.getKey()).iterator();
while (it5.hasNext()) {
c0327g.d(this.G.v(it5.next()));
}
c0327g.c();
}
} finally {
c0327g.b();
}
}
private int s(q5.f fVar, ByteArrayOutputStream byteArrayOutputStream, MethodKey methodkey, List<? extends d5.k<? extends d5.e>> list, Iterable<? extends f5.f> iterable, int i6) throws IOException {
int b6;
if (iterable == null && i6 == 0) {
return -1;
}
this.f25777z++;
fVar.d();
int position = fVar.getPosition();
fVar.w(this.G.h0(methodkey));
fVar.w(p5.g.c(this.J.q(this.D.d0(this.F.F(methodkey))), o4.a.STATIC.f(this.G.g0(methodkey))));
if (iterable != null) {
List<d5.k> f6 = t5.c.f(list);
int i7 = 0;
int i8 = 0;
for (f5.f fVar2 : iterable) {
i8 += fVar2.e();
if (fVar2.m().f24958t == 3) {
h5.e eVar = (h5.e) ((f5.j) fVar2).d();
o4.g m6 = fVar2.m();
if (p5.f.a(m6)) {
b6 = ((f5.p) fVar2).a();
} else {
b6 = p5.g.b(eVar, p5.f.b(m6));
}
if (b6 > i7) {
i7 = b6;
}
}
}
fVar.w(i7);
fVar.w(f6.size());
fVar.k(i6);
l e6 = l.e(this.f25752a, fVar, this.B, this.C, this.E, this.F, this.D, this.I, this.H);
fVar.k(i8);
int i9 = 0;
for (f5.f fVar3 : iterable) {
try {
switch (d.f25779a[fVar3.m().f24959u.ordinal()]) {
case 1:
e6.h((g5.b) fVar3);
i9 += fVar3.e();
case 2:
e6.i((g5.c) fVar3);
i9 += fVar3.e();
case 3:
e6.j((g5.d) fVar3);
i9 += fVar3.e();
case 4:
e6.k((g5.e) fVar3);
i9 += fVar3.e();
case 5:
e6.l((g5.f) fVar3);
i9 += fVar3.e();
case 6:
e6.m((g5.g) fVar3);
i9 += fVar3.e();
case 7:
e6.n((g5.h) fVar3);
i9 += fVar3.e();
case 8:
e6.o((g5.i) fVar3);
i9 += fVar3.e();
case 9:
e6.p((g5.j) fVar3);
i9 += fVar3.e();
case 10:
e6.q((g5.k) fVar3);
i9 += fVar3.e();
case 11:
e6.r((g5.l) fVar3);
i9 += fVar3.e();
case 12:
e6.s((g5.m) fVar3);
i9 += fVar3.e();
case 13:
e6.t((g5.n) fVar3);
i9 += fVar3.e();
case 14:
e6.u((g5.o) fVar3);
i9 += fVar3.e();
case 15:
e6.v((g5.p) fVar3);
i9 += fVar3.e();
case 16:
e6.w((g5.q) fVar3);
i9 += fVar3.e();
case 17:
e6.x((g5.r) fVar3);
i9 += fVar3.e();
case 18:
e6.y((g5.s) fVar3);
i9 += fVar3.e();
case 19:
e6.z((g5.t) fVar3);
i9 += fVar3.e();
case 20:
e6.A((g5.u) fVar3);
i9 += fVar3.e();
case 21:
e6.B((g5.v) fVar3);
i9 += fVar3.e();
case 22:
e6.C((w) fVar3);
i9 += fVar3.e();
case 23:
e6.D((x) fVar3);
i9 += fVar3.e();
case 24:
e6.E((y) fVar3);
i9 += fVar3.e();
case 25:
e6.F((z) fVar3);
i9 += fVar3.e();
case 26:
e6.G((a0) fVar3);
i9 += fVar3.e();
case 27:
e6.H((b0) fVar3);
i9 += fVar3.e();
case 28:
e6.I((c0) fVar3);
i9 += fVar3.e();
case 29:
e6.J((d0) fVar3);
i9 += fVar3.e();
case 30:
e6.K((e0) fVar3);
i9 += fVar3.e();
case 31:
e6.L((f0) fVar3);
i9 += fVar3.e();
case 32:
e6.M((g0) fVar3);
i9 += fVar3.e();
case 33:
e6.N((h0) fVar3);
i9 += fVar3.e();
case 34:
e6.g((g5.a) fVar3);
i9 += fVar3.e();
case 35:
e6.O((i0) fVar3);
i9 += fVar3.e();
case 36:
e6.P((j0) fVar3);
i9 += fVar3.e();
default:
throw new v5.g("Unsupported instruction format: %s", fVar3.m().f24959u);
}
} catch (RuntimeException e7) {
throw new v5.g(e7, "Error while writing instruction at code offset 0x%x", Integer.valueOf(i9));
}
}
if (f6.size() > 0) {
fVar.d();
HashMap h6 = Maps.h();
Iterator it = f6.iterator();
while (it.hasNext()) {
h6.put(((d5.k) it.next()).b(), 0);
}
q5.f.v(byteArrayOutputStream, h6.size());
for (d5.k kVar : f6) {
int a7 = kVar.a();
int c6 = (kVar.c() + a7) - a7;
fVar.k(a7);
fVar.w(c6);
if (kVar.b().size() != 0) {
Integer num = (Integer) h6.get(kVar.b());
if (num.intValue() != 0) {
fVar.w(num.intValue());
} else {
Integer valueOf = Integer.valueOf(byteArrayOutputStream.size());
fVar.w(valueOf.intValue());
h6.put(kVar.b(), valueOf);
int size = kVar.b().size();
if (((d5.e) kVar.b().get(size - 1)).i0() == null) {
size = (size * (-1)) + 1;
}
q5.f.r(byteArrayOutputStream, size);
for (d5.e eVar2 : kVar.b()) {
CharSequence j6 = this.G.j(eVar2);
int o02 = eVar2.o0();
if (j6 != null) {
q5.f.v(byteArrayOutputStream, this.C.j0(j6));
q5.f.v(byteArrayOutputStream, o02);
} else {
q5.f.v(byteArrayOutputStream, o02);
}
}
}
} else {
throw new v5.g("No exception handlers for the try block!", new Object[0]);
}
}
if (byteArrayOutputStream.size() > 0) {
byteArrayOutputStream.writeTo(fVar);
byteArrayOutputStream.reset();
}
}
} else {
fVar.w(0);
fVar.w(0);
fVar.k(i6);
fVar.k(0);
}
return position;
}
private void t(q5.f fVar, s5.a aVar) throws IOException {
List<? extends d5.k<? extends d5.e>> list;
Iterable<? extends f5.f> iterable;
int s6;
boolean z6;
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
this.f25769r = fVar.getPosition();
q5.e eVar = new q5.e(this.B, this.C, fVar);
q5.f fVar2 = new q5.f(aVar, 0);
ArrayList<e> g6 = Lists.g();
for (Comparable comparable : this.G.A()) {
for (Object obj : Iterables.e(this.G.h(comparable), this.G.g(comparable))) {
List<? extends d5.k<? extends d5.e>> H = this.G.H(obj);
Iterable<? extends f5.f> t6 = this.G.t(obj);
Iterable<? extends e5.a> T = this.G.T(obj);
try {
if (t6 != null && this.B.m0()) {
Iterator<? extends f5.f> it = t6.iterator();
while (true) {
if (it.hasNext()) {
f5.f next = it.next();
if (next.m() == o4.g.X && this.B.j0((h5.g) ((f5.j) next).d()) >= 65536) {
z6 = true;
break;
}
} else {
z6 = false;
break;
}
}
if (z6) {
u4.n O = this.G.O(obj);
d(O);
iterable = O.b();
list = O.d();
T = O.c();
ByteArrayOutputStream byteArrayOutputStream2 = byteArrayOutputStream;
s6 = s(fVar2, byteArrayOutputStream, obj, list, iterable, u(fVar, eVar, this.G.z(obj), T));
if (s6 == -1) {
g6.add(new e(obj, s6, null));
}
byteArrayOutputStream = byteArrayOutputStream2;
}
}
s6 = s(fVar2, byteArrayOutputStream, obj, list, iterable, u(fVar, eVar, this.G.z(obj), T));
if (s6 == -1) {
}
byteArrayOutputStream = byteArrayOutputStream2;
} catch (RuntimeException e6) {
throw new v5.g(e6, "Exception occurred while writing code_item for method %s", this.F.s(obj));
}
list = H;
iterable = t6;
ByteArrayOutputStream byteArrayOutputStream22 = byteArrayOutputStream;
}
}
fVar.d();
this.f25770s = fVar.getPosition();
fVar2.close();
aVar.d(fVar);
aVar.close();
for (e eVar2 : g6) {
this.G.W(eVar2.f25780a, this.f25770s + eVar2.f25781b);
}
}
private int u(q5.f fVar, q5.e<StringKey, TypeKey> eVar, Iterable<? extends StringKey> iterable, Iterable<? extends e5.a> iterable2) throws IOException {
int i6;
int i7;
int i8;
if (iterable != null) {
i6 = Iterables.j(iterable);
Iterator<? extends StringKey> it = iterable.iterator();
i7 = -1;
int i9 = 0;
while (it.hasNext()) {
if (it.next() != null) {
i7 = i9;
}
i9++;
}
} else {
i6 = 0;
i7 = -1;
}
if (i7 == -1 && (iterable2 == null || Iterables.h(iterable2))) {
return 0;
}
this.f25776y++;
int position = fVar.getPosition();
if (iterable2 != null) {
for (e5.a aVar : iterable2) {
if (aVar instanceof e5.d) {
i8 = ((e5.d) aVar).getLineNumber();
break;
}
}
}
i8 = 0;
fVar.u(i8);
fVar.u(i6);
if (iterable != null) {
int i10 = 0;
for (StringKey stringkey : iterable) {
if (i10 == i6) {
break;
}
i10++;
fVar.u(this.B.f(stringkey) + 1);
}
}
if (iterable2 != null) {
eVar.a(i8);
Iterator<? extends e5.a> it2 = iterable2.iterator();
while (it2.hasNext()) {
this.G.V(eVar, it2.next());
}
}
fVar.write(0);
return position;
}
private void v(q5.f fVar) throws IOException {
f fVar2 = new f(this, fVar, null);
this.f25764m = fVar.getPosition();
for (Map.Entry entry : this.M.b()) {
entry.setValue(Integer.valueOf(fVar.getPosition()));
List I = this.M.I(entry.getKey());
fVar.u(I.size());
Iterator it = I.iterator();
while (it.hasNext()) {
y(fVar2, it.next());
}
}
}
private void w(q5.f fVar, Collection<? extends FieldKey> collection) throws IOException {
int i6 = 0;
for (FieldKey fieldkey : collection) {
int B = this.E.B(fieldkey);
if (!this.G.X(fieldkey).isEmpty()) {
this.f25773v = true;
}
fVar.u(B - i6);
fVar.u(this.G.m(fieldkey));
i6 = B;
}
}
private void x(q5.f fVar, Collection<? extends MethodKey> collection) throws IOException {
int i6 = 0;
for (MethodKey methodkey : collection) {
int Q = this.F.Q(methodkey);
if (!this.G.v(methodkey).isEmpty()) {
this.f25773v = true;
}
fVar.u(Q - i6);
fVar.u(this.G.g0(methodkey));
fVar.u(this.G.c0(methodkey));
i6 = Q;
}
}
private void z(q5.f fVar) throws IOException {
this.f25756e = fVar.getPosition();
ArrayList<Map.Entry> h6 = Lists.h(this.E.b());
Collections.sort(h6, c());
int i6 = 0;
for (Map.Entry entry : h6) {
int i7 = i6 + 1;
entry.setValue(Integer.valueOf(i6));
h5.b bVar = (h5.b) entry.getKey();
fVar.w(this.C.j0(this.E.l0(bVar)));
fVar.w(this.C.j0(this.E.x(bVar)));
fVar.k(this.B.j0(this.E.y(bVar)));
i6 = i7;
}
}
public void I(s5.c cVar) throws IOException {
J(cVar, s5.e.g());
}
public void J(s5.c cVar, s5.b bVar) throws IOException {
try {
int e6 = e();
q5.f g6 = g(cVar, 0);
q5.f g7 = g(cVar, 112);
q5.f g8 = g(cVar, e6);
try {
H(g7, g8);
L(g7);
K(g8);
F(g7);
z(g7);
E(g7);
q5.f g9 = g(cVar, g7.getPosition() + (this.G.a0() * 32) + (this.H.a0() * 4));
try {
D(g9);
g9.close();
v(g8);
q5.f g10 = g(cVar, g7.getPosition() + (this.G.a0() * 32));
try {
p(g10);
g10.close();
o(g8);
n(g8);
m(g8);
l(g8);
t(g8, bVar.a());
r(cVar, g7, g8);
B(g8);
A(g6, e6, g8.getPosition());
g6.close();
g7.close();
g8.close();
k(cVar);
j(cVar);
} catch (Throwable th) {
g10.close();
throw th;
}
} catch (Throwable th2) {
g9.close();
throw th2;
}
} catch (Throwable th3) {
g6.close();
g7.close();
g8.close();
throw th3;
}
} finally {
cVar.close();
}
}
protected abstract g<StringKey, StringRef, TypeKey, TypeRef, ProtoRefKey, FieldRefKey, MethodRefKey, ClassKey, CallSiteKey, MethodHandleKey, AnnotationKey, AnnotationSetKey, TypeListKey, FieldKey, MethodKey, EncodedArrayKey, EncodedValue, AnnotationElement, StringSectionType, TypeSectionType, ProtoSectionType, FieldSectionType, MethodSectionType, ClassSectionType, CallSiteSectionType, MethodHandleSectionType, TypeListSectionType, AnnotationSectionType, AnnotationSetSectionType, EncodedArraySectionType>.h f();
protected abstract void y(g<StringKey, StringRef, TypeKey, TypeRef, ProtoRefKey, FieldRefKey, MethodRefKey, ClassKey, CallSiteKey, MethodHandleKey, AnnotationKey, AnnotationSetKey, TypeListKey, FieldKey, MethodKey, EncodedArrayKey, EncodedValue, AnnotationElement, StringSectionType, TypeSectionType, ProtoSectionType, FieldSectionType, MethodSectionType, ClassSectionType, CallSiteSectionType, MethodHandleSectionType, TypeListSectionType, AnnotationSectionType, AnnotationSetSectionType, EncodedArraySectionType>.f fVar, EncodedValue encodedvalue) throws IOException;
}