package defpackage;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.zip.CRC32;

/* renamed from: ᵯʥʽ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public final class C4254 extends OutputStream {

    /* renamed from: ˀᵗᵝᵭ, reason: contains not printable characters */
    public ᵼᵫᵧˀ f15926;

    /* renamed from: ˎˑː, reason: contains not printable characters */
    public C1601 f15927;

    /* renamed from: ˑᵥˁ, reason: contains not printable characters */
    public CRC32 f15928;

    /* renamed from: ᐧﾞ, reason: contains not printable characters */
    public boolean f15929;

    /* renamed from: ᵡˎ, reason: contains not printable characters */
    public ᵧˉʙ f15930;

    /* renamed from: ᵡⁱᵥ, reason: contains not printable characters */
    public C3182 f15931;

    /* renamed from: ᵢˇᵭ, reason: contains not printable characters */
    public char[] f15932;

    /* renamed from: ᵤᵙᵷ, reason: contains not printable characters */
    public C1451 f15933;

    /* renamed from: ᵧـˌᵎ, reason: contains not printable characters */
    public C2723 f15934;

    /* renamed from: ᵧᵾˀˈ, reason: contains not printable characters */
    public C4277 f15935;

    /* renamed from: ᵮᵠـˌ, reason: contains not printable characters */
    public long f15936;

    /* renamed from: ᵺʙ, reason: contains not printable characters */
    public boolean f15937;

    /* renamed from: ᵾᵬ, reason: contains not printable characters */
    public AbstractC0462 f15938;

    /* renamed from: ᵿʗᵝʽ, reason: contains not printable characters */
    public C4348 f15939;

    @Override // java.io.OutputStream, java.io.Closeable, java.lang.AutoCloseable
    public final void close() throws IOException {
        C4348 c4348 = this.f15939;
        C4277 c4277 = this.f15935;
        if (!this.f15929) {
            m9204();
        }
        C0737 c0737 = c4348.f16277;
        C4218 c4218 = c4277.f16049;
        c0737.f3553 = AbstractC3915.m8586(c4218) ? c4218.f15809.getFilePointer() : c4277.f16048;
        ᵧˉʙ r2 = this.f15930;
        this.f15934.getClass();
        r2.ˑᵱ(c4348, c4277);
        c4277.close();
        this.f15937 = true;
    }

    @Override // java.io.OutputStream
    public final void write(int i) throws IOException {
        write(new byte[]{(byte) i}, 0, 1);
    }

    @Override // java.io.OutputStream
    public final void write(byte[] bArr) throws IOException {
        write(bArr, 0, bArr.length);
    }

    @Override // java.io.OutputStream
    public final void write(byte[] bArr, int i, int i2) throws IOException {
        if (this.f15937) {
            C0910.m3045("Stream is closed");
            return;
        }
        this.f15928.update(bArr, i, i2);
        this.f15938.write(bArr, i, i2);
        this.f15936 += i2;
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Removed duplicated region for block: B:151:0x02fd  */
    /* JADX WARN: Removed duplicated region for block: B:159:0x031a A[Catch: all -> 0x0312, TryCatch #0 {all -> 0x0312, blocks: (B:154:0x0305, B:160:0x032d, B:162:0x0337, B:163:0x033d, B:167:0x0346, B:169:0x034a, B:170:0x034c, B:172:0x0354, B:175:0x035b, B:177:0x036e, B:179:0x0372, B:180:0x03ad, B:159:0x031a), top: B:220:0x02fb }] */
    /* JADX WARN: Removed duplicated region for block: B:162:0x0337 A[Catch: all -> 0x0312, TryCatch #0 {all -> 0x0312, blocks: (B:154:0x0305, B:160:0x032d, B:162:0x0337, B:163:0x033d, B:167:0x0346, B:169:0x034a, B:170:0x034c, B:172:0x0354, B:175:0x035b, B:177:0x036e, B:179:0x0372, B:180:0x03ad, B:159:0x031a), top: B:220:0x02fb }] */
    /* JADX WARN: Removed duplicated region for block: B:165:0x0343  */
    /* JADX WARN: Removed duplicated region for block: B:166:0x0344  */
    /* JADX WARN: Removed duplicated region for block: B:169:0x034a A[Catch: all -> 0x0312, TryCatch #0 {all -> 0x0312, blocks: (B:154:0x0305, B:160:0x032d, B:162:0x0337, B:163:0x033d, B:167:0x0346, B:169:0x034a, B:170:0x034c, B:172:0x0354, B:175:0x035b, B:177:0x036e, B:179:0x0372, B:180:0x03ad, B:159:0x031a), top: B:220:0x02fb }] */
    /* JADX WARN: Removed duplicated region for block: B:172:0x0354 A[Catch: all -> 0x0312, TryCatch #0 {all -> 0x0312, blocks: (B:154:0x0305, B:160:0x032d, B:162:0x0337, B:163:0x033d, B:167:0x0346, B:169:0x034a, B:170:0x034c, B:172:0x0354, B:175:0x035b, B:177:0x036e, B:179:0x0372, B:180:0x03ad, B:159:0x031a), top: B:220:0x02fb }] */
    /* JADX WARN: Removed duplicated region for block: B:175:0x035b A[Catch: all -> 0x0312, TryCatch #0 {all -> 0x0312, blocks: (B:154:0x0305, B:160:0x032d, B:162:0x0337, B:163:0x033d, B:167:0x0346, B:169:0x034a, B:170:0x034c, B:172:0x0354, B:175:0x035b, B:177:0x036e, B:179:0x0372, B:180:0x03ad, B:159:0x031a), top: B:220:0x02fb }] */
    /* JADX WARN: Removed duplicated region for block: B:176:0x036d  */
    /* JADX WARN: Removed duplicated region for block: B:179:0x0372 A[Catch: all -> 0x0312, TryCatch #0 {all -> 0x0312, blocks: (B:154:0x0305, B:160:0x032d, B:162:0x0337, B:163:0x033d, B:167:0x0346, B:169:0x034a, B:170:0x034c, B:172:0x0354, B:175:0x035b, B:177:0x036e, B:179:0x0372, B:180:0x03ad, B:159:0x031a), top: B:220:0x02fb }] */
    /* JADX WARN: Removed duplicated region for block: B:183:0x03c9  */
    /* JADX WARN: Removed duplicated region for block: B:185:0x03d6  */
    /* JADX WARN: Removed duplicated region for block: B:197:0x0404  */
    /* JADX WARN: Removed duplicated region for block: B:198:0x041d  */
    /* JADX WARN: Type inference failed for: r11v1 */
    /* JADX WARN: Type inference failed for: r11v13, types: [int] */
    /* JADX WARN: Type inference failed for: r11v14 */
    /* JADX WARN: Type inference failed for: r11v16, types: [java.io.ByteArrayOutputStream, java.io.OutputStream] */
    /* JADX WARN: Type inference failed for: r11v24 */
    /* JADX WARN: Type inference failed for: r11v27 */
    /* JADX WARN: Type inference failed for: r11v28 */
    /* JADX WARN: Type inference failed for: r11v3 */
    /* JADX WARN: Type inference failed for: r1v19, types: [ʿᵯᵴ, ᵿᵳˁᵴ] */
    /* JADX WARN: Type inference failed for: r1v8, types: [ˌᵎʕᵪ] */
    /* JADX WARN: Type inference failed for: r3v4, types: [ˉᵿᵕ, ᵦˎˇ] */
    /* renamed from: ˏᵙ, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public final void m9203(defpackage.C5254 r22) throws java.lang.Throwable {
        /*
            Method dump skipped, instructions count: 1112
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: defpackage.C4254.m9203(ᵼˇـ):void");
    }

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public final C1451 m9204() throws IOException {
        C4348 c4348 = this.f15939;
        CRC32 crc32 = this.f15928;
        this.f15938.mo2064();
        long j = this.f15938.f2525.f13382.f4792;
        C1451 c1451 = this.f15933;
        c1451.f4037 = j;
        C3182 c3182 = this.f15931;
        c3182.f4037 = j;
        long j2 = this.f15936;
        c1451.f4034 = j2;
        c3182.f4034 = j2;
        if ((c1451.f4044 && AbstractC1327.m4108(c1451.f4035, 4)) ? AbstractC1327.m4108(c1451.f4047.f6838, 1) : true) {
            this.f15933.f4030 = crc32.getValue();
            this.f15931.f4030 = crc32.getValue();
        }
        c4348.f16275.add(this.f15931);
        c4348.f16273.f11143.add(this.f15933);
        C3182 c31822 = this.f15931;
        if (c31822.f4043) {
            ᵧˉʙ r2 = this.f15930;
            C4277 c4277 = this.f15935;
            C1601 c1601 = (C1601) r2.ᵢˇᵭ;
            byte[] bArr = (byte[]) r2.ᵿʗᵝʽ;
            if (c4277 == null) {
                C0190.m1425("input parameters is null, cannot write extended local header");
                return null;
            }
            ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
            try {
                c1601.m4591(byteArrayOutputStream, 134695760);
                C1601.m4583(c31822.f4030, bArr);
                byteArrayOutputStream.write(bArr, 0, 4);
                boolean z = c31822.f12060;
                long j3 = c31822.f4037;
                if (z) {
                    c1601.m4585(byteArrayOutputStream, j3);
                    c1601.m4585(byteArrayOutputStream, c31822.f4034);
                } else {
                    C1601.m4583(j3, bArr);
                    byteArrayOutputStream.write(bArr, 0, 4);
                    C1601.m4583(c31822.f4034, bArr);
                    byteArrayOutputStream.write(bArr, 0, 4);
                }
                c4277.write(byteArrayOutputStream.toByteArray());
                byteArrayOutputStream.close();
            } catch (Throwable th) {
                try {
                    byteArrayOutputStream.close();
                } catch (Throwable th2) {
                    th.addSuppressed(th2);
                }
                throw th;
            }
        }
        this.f15936 = 0L;
        crc32.reset();
        this.f15938.close();
        this.f15929 = true;
        return this.f15933;
    }
}
