package p463.p484.p485.p490;

import java.io.DataInput;
import java.io.DataOutput;
import java.io.Externalizable;
import java.io.IOException;
import java.io.InvalidClassException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.io.StreamCorruptedException;
import p463.p484.p485.C7192;

/* JADX INFO: renamed from: ޒ.ށ.֏.ޔ.֏, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public final class C7289 implements Externalizable {

    /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
    public byte f21167;

    /* JADX INFO: renamed from: ބ, reason: contains not printable characters */
    public Object f21168;

    public C7289() {
    }

    public C7289(byte b, Object obj) {
        this.f21167 = b;
        this.f21168 = obj;
    }

    private Object readResolve() {
        return this.f21168;
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public static long m10927(DataInput dataInput) {
        int i = dataInput.readByte() & 255;
        if (i == 255) {
            return dataInput.readLong();
        }
        return (((long) (((i << 16) + ((dataInput.readByte() & 255) << 8)) + (dataInput.readByte() & 255))) * 900) - 4575744000L;
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public static Object m10928(byte b, DataInput dataInput) throws IOException {
        if (b != 1) {
            if (b != 2) {
                if (b == 3) {
                    return C7294.m10943(dataInput);
                }
                throw new StreamCorruptedException("Unknown serialized type");
            }
            long jM10927 = m10927(dataInput);
            C7192 c7192M10931 = m10931(dataInput);
            C7192 c7192M109312 = m10931(dataInput);
            if (c7192M10931.equals(c7192M109312)) {
                throw new IllegalArgumentException("Offsets must not be equal");
            }
            return new C7293(jM10927, c7192M10931, c7192M109312);
        }
        int i = dataInput.readInt();
        long[] jArr = new long[i];
        for (int i2 = 0; i2 < i; i2++) {
            jArr[i2] = m10927(dataInput);
        }
        int i3 = i + 1;
        C7192[] c7192Arr = new C7192[i3];
        for (int i4 = 0; i4 < i3; i4++) {
            c7192Arr[i4] = m10931(dataInput);
        }
        int i5 = dataInput.readInt();
        long[] jArr2 = new long[i5];
        for (int i6 = 0; i6 < i5; i6++) {
            jArr2[i6] = m10927(dataInput);
        }
        int i7 = i5 + 1;
        C7192[] c7192Arr2 = new C7192[i7];
        for (int i8 = 0; i8 < i7; i8++) {
            c7192Arr2[i8] = m10931(dataInput);
        }
        int i9 = dataInput.readByte();
        C7294[] c7294Arr = new C7294[i9];
        for (int i10 = 0; i10 < i9; i10++) {
            c7294Arr[i10] = C7294.m10943(dataInput);
        }
        return new C7290(jArr, c7192Arr, jArr2, c7192Arr2, c7294Arr);
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public static void m10929(long j, DataOutput dataOutput) throws IOException {
        if (j < -4575744000L || j >= 10413792000L || j % 900 != 0) {
            dataOutput.writeByte(255);
            dataOutput.writeLong(j);
        } else {
            int i = (int) ((j + 4575744000L) / 900);
            dataOutput.writeByte((i >>> 16) & 255);
            dataOutput.writeByte((i >>> 8) & 255);
            dataOutput.writeByte(i & 255);
        }
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public static void m10930(C7192 c7192, DataOutput dataOutput) throws IOException {
        int i = c7192.f20855;
        int i2 = i % 900 == 0 ? i / 900 : 127;
        dataOutput.writeByte(i2);
        if (i2 == 127) {
            dataOutput.writeInt(i);
        }
    }

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public static C7192 m10931(DataInput dataInput) throws IOException {
        byte b = dataInput.readByte();
        return b == 127 ? C7192.m10740(dataInput.readInt()) : C7192.m10740(b * 900);
    }

    @Override // java.io.Externalizable
    public void readExternal(ObjectInput objectInput) {
        byte b = objectInput.readByte();
        this.f21167 = b;
        this.f21168 = m10928(b, objectInput);
    }

    @Override // java.io.Externalizable
    public void writeExternal(ObjectOutput objectOutput) throws IOException {
        byte b = this.f21167;
        Object obj = this.f21168;
        objectOutput.writeByte(b);
        if (b != 1) {
            if (b != 2) {
                if (b != 3) {
                    throw new InvalidClassException("Unknown serialized type");
                }
                ((C7294) obj).m10944(objectOutput);
                return;
            } else {
                C7293 c7293 = (C7293) obj;
                m10929(c7293.f21182.m10764(c7293.f21183), objectOutput);
                m10930(c7293.f21183, objectOutput);
                m10930(c7293.f21184, objectOutput);
                return;
            }
        }
        C7290 c7290 = (C7290) obj;
        objectOutput.writeInt(c7290.f21169.length);
        for (long j : c7290.f21169) {
            m10929(j, objectOutput);
        }
        for (C7192 c7192 : c7290.f21170) {
            m10930(c7192, objectOutput);
        }
        objectOutput.writeInt(c7290.f21171.length);
        for (long j2 : c7290.f21171) {
            m10929(j2, objectOutput);
        }
        for (C7192 c71922 : c7290.f21173) {
            m10930(c71922, objectOutput);
        }
        objectOutput.writeByte(c7290.f21174.length);
        for (C7294 c7294 : c7290.f21174) {
            c7294.m10944(objectOutput);
        }
    }
}
