package defpackage;

import java.io.IOException;
import java.io.InputStream;
import java.io.PushbackInputStream;
import java.util.zip.Inflater;

/* renamed from: ˁˁʾᵶ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public final class C0654 extends AbstractC0736 {

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

    /* renamed from: ᵤᵙᵷ, reason: contains not printable characters */
    public byte[] f3265;

    /* renamed from: ᵾᵬ, reason: contains not printable characters */
    public byte[] f3266;

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

    @Override // defpackage.AbstractC0736, java.io.InputStream, java.io.Closeable, java.lang.AutoCloseable
    public final void close() throws IOException {
        Inflater inflater = this.f3267;
        if (inflater != null) {
            inflater.end();
        }
        super.close();
    }

    @Override // defpackage.AbstractC0736, java.io.InputStream
    public final int read() {
        byte[] bArr = this.f3265;
        if (read(bArr, 0, bArr.length) == -1) {
            return -1;
        }
        return bArr[0];
    }

    @Override // defpackage.AbstractC0736, java.io.InputStream
    public final int read(byte[] bArr) {
        return read(bArr, 0, bArr.length);
    }

    /* JADX WARN: Code restructure failed: missing block: B:16:0x003e, code lost:
    
        return -1;
     */
    @Override // defpackage.AbstractC0736, java.io.InputStream
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public final int read(byte[] r6, int r7, int r8) throws java.util.zip.DataFormatException, java.io.IOException {
        /*
            r5 = this;
        L0:
            java.util.zip.Inflater r0 = r5.f3267     // Catch: java.util.zip.DataFormatException -> L40
            int r0 = r0.inflate(r6, r7, r8)     // Catch: java.util.zip.DataFormatException -> L40
            if (r0 != 0) goto L3f
            java.util.zip.Inflater r0 = r5.f3267     // Catch: java.util.zip.DataFormatException -> L40
            boolean r0 = r0.finished()     // Catch: java.util.zip.DataFormatException -> L40
            r1 = -1
            if (r0 != 0) goto L3e
            java.util.zip.Inflater r0 = r5.f3267     // Catch: java.util.zip.DataFormatException -> L40
            boolean r0 = r0.needsDictionary()     // Catch: java.util.zip.DataFormatException -> L40
            if (r0 == 0) goto L1a
            goto L3e
        L1a:
            java.util.zip.Inflater r0 = r5.f3267     // Catch: java.util.zip.DataFormatException -> L40
            boolean r0 = r0.needsInput()     // Catch: java.util.zip.DataFormatException -> L40
            if (r0 == 0) goto L0
            byte[] r0 = r5.f3266     // Catch: java.util.zip.DataFormatException -> L40
            int r2 = r0.length     // Catch: java.util.zip.DataFormatException -> L40
            ᵹᵻ r3 = r5.f3552     // Catch: java.util.zip.DataFormatException -> L40
            r4 = 0
            int r2 = r3.read(r0, r4, r2)     // Catch: java.util.zip.DataFormatException -> L40
            r5.f3264 = r2     // Catch: java.util.zip.DataFormatException -> L40
            if (r2 == r1) goto L36
            java.util.zip.Inflater r1 = r5.f3267     // Catch: java.util.zip.DataFormatException -> L40
            r1.setInput(r0, r4, r2)     // Catch: java.util.zip.DataFormatException -> L40
            goto L0
        L36:
            java.io.EOFException r5 = new java.io.EOFException     // Catch: java.util.zip.DataFormatException -> L40
            java.lang.String r6 = "Unexpected end of input stream"
            r5.<init>(r6)     // Catch: java.util.zip.DataFormatException -> L40
            throw r5     // Catch: java.util.zip.DataFormatException -> L40
        L3e:
            return r1
        L3f:
            return r0
        L40:
            r5 = move-exception
            java.io.IOException r6 = new java.io.IOException
            r6.<init>(r5)
            throw r6
        */
        throw new UnsupportedOperationException("Method not decompiled: defpackage.C0654.read(byte[], int, int):int");
    }

    @Override // defpackage.AbstractC0736
    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public final int mo2592(PushbackInputStream pushbackInputStream) throws IOException {
        int remaining = this.f3267.getRemaining();
        if (remaining > 0) {
            pushbackInputStream.unread(this.f3552.f19013, this.f3264 - remaining, remaining);
        }
        return remaining;
    }

    @Override // defpackage.AbstractC0736
    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public final void mo2593(InputStream inputStream, int i) {
        Inflater inflater = this.f3267;
        if (inflater != null) {
            inflater.end();
            this.f3267 = null;
        }
        super.mo2593(inputStream, i);
    }
}
