package com.github.henryye.nativeiv.b;

public final class a {
    /* JADX WARNING: Removed duplicated region for block: B:20:0x0078 A:{Splitter:B:6:0x0031, ExcHandler: IOException (r0_10 'e' java.io.IOException)} */
    /* JADX WARNING: Failed to process nested try/catch */
    /* JADX WARNING: Missing block: B:20:0x0078, code skipped:
            r0 = move-exception;
     */
    /* JADX WARNING: Missing block: B:22:?, code skipped:
            com.tencent.magicbrush.a.c.c.a("Ni.ByteBufferUtil", r0, "hy: allocateByteBufferFromStream IOException", new java.lang.Object[0]);
     */
    /* JADX WARNING: Missing block: B:24:?, code skipped:
            r11.reset();
     */
    /* JADX WARNING: Missing block: B:26:0x008d, code skipped:
            r0 = move-exception;
     */
    /* JADX WARNING: Missing block: B:27:0x008e, code skipped:
            com.tencent.magicbrush.a.c.c.a("Ni.ByteBufferUtil", r0, "hy: exception in finally!", new java.lang.Object[0]);
     */
    /* JADX WARNING: Missing block: B:38:?, code skipped:
            r11.reset();
     */
    /* JADX WARNING: Missing block: B:39:0x00bd, code skipped:
            com.tencent.matrix.trace.core.AppMethodBeat.o(115772);
     */
    /* JADX WARNING: Missing block: B:41:0x00c1, code skipped:
            r1 = move-exception;
     */
    /* JADX WARNING: Missing block: B:42:0x00c2, code skipped:
            com.tencent.magicbrush.a.c.c.a("Ni.ByteBufferUtil", r1, "hy: exception in finally!", new java.lang.Object[0]);
     */
    /* JADX WARNING: Missing block: B:43:0x00ce, code skipped:
            r1 = e;
     */
    public static java.nio.ByteBuffer f(java.io.InputStream r11) {
        /*
        r1 = 0;
        r4 = 100000; // 0x186a0 float:1.4013E-40 double:4.94066E-319;
        r10 = 115772; // 0x1c43c float:1.62231E-40 double:5.7199E-319;
        r6 = 0;
        com.tencent.matrix.trace.core.AppMethodBeat.i(r10);
        r0 = r11.markSupported();
        if (r0 != 0) goto L_0x0018;
    L_0x0011:
        r11 = com.github.henryye.nativeiv.b.d.h(r11);
        com.github.henryye.nativeiv.b.d.i(r11);
    L_0x0018:
        if (r11 != 0) goto L_0x001f;
    L_0x001a:
        com.tencent.matrix.trace.core.AppMethodBeat.o(r10);
        r0 = r1;
    L_0x001e:
        return r0;
    L_0x001f:
        r0 = 10000; // 0x2710 float:1.4013E-41 double:4.9407E-320;
        r8 = new byte[r0];
        r2 = java.nio.ByteBuffer.allocateDirect(r4);
        r0 = java.nio.ByteOrder.nativeOrder();
        r2.order(r0);
        r3 = r4;
        r5 = r6;
        r7 = r6;
    L_0x0031:
        r9 = r11.read(r8);	 Catch:{ IOException -> 0x0078, BufferOverflowException -> 0x009a }
        r5 = r5 + r9;
        if (r5 <= r3) goto L_0x00d0;
    L_0x0038:
        r0 = r2.capacity();	 Catch:{ IOException -> 0x0078, BufferOverflowException -> 0x009a }
        r0 = r0 + r4;
        r0 = java.nio.ByteBuffer.allocateDirect(r0);	 Catch:{ IOException -> 0x0078, BufferOverflowException -> 0x009a }
        r3 = java.nio.ByteOrder.nativeOrder();	 Catch:{ IOException -> 0x0078, BufferOverflowException -> 0x009a }
        r0.order(r3);	 Catch:{ IOException -> 0x0078, BufferOverflowException -> 0x009a }
        r3 = 0;
        r2.position(r3);	 Catch:{ IOException -> 0x0078, BufferOverflowException -> 0x009a }
        r0.put(r2);	 Catch:{ IOException -> 0x0078, BufferOverflowException -> 0x009a }
        r2 = r0.capacity();	 Catch:{ IOException -> 0x0078, BufferOverflowException -> 0x00ce }
        r3 = r2;
    L_0x0054:
        if (r9 < 0) goto L_0x0060;
    L_0x0056:
        r0.position(r7);	 Catch:{ IOException -> 0x0078, BufferOverflowException -> 0x00ce }
        r2 = 0;
        r0.put(r8, r2, r9);	 Catch:{ IOException -> 0x0078, BufferOverflowException -> 0x00ce }
        r7 = r7 + r9;
        r2 = r0;
        goto L_0x0031;
    L_0x0060:
        r2 = 0;
        r0.position(r2);	 Catch:{ IOException -> 0x0078, BufferOverflowException -> 0x00ce }
        r11.reset();	 Catch:{ Exception -> 0x006b }
    L_0x0067:
        com.tencent.matrix.trace.core.AppMethodBeat.o(r10);
        goto L_0x001e;
    L_0x006b:
        r1 = move-exception;
        r2 = "Ni.ByteBufferUtil";
        r3 = "hy: exception in finally!";
        r4 = new java.lang.Object[r6];
        com.tencent.magicbrush.a.c.c.a(r2, r1, r3, r4);
        goto L_0x0067;
    L_0x0078:
        r0 = move-exception;
        r2 = "Ni.ByteBufferUtil";
        r3 = "hy: allocateByteBufferFromStream IOException";
        r4 = 0;
        r4 = new java.lang.Object[r4];	 Catch:{ all -> 0x00b9 }
        com.tencent.magicbrush.a.c.c.a(r2, r0, r3, r4);	 Catch:{ all -> 0x00b9 }
        r11.reset();	 Catch:{ Exception -> 0x008d }
    L_0x0088:
        com.tencent.matrix.trace.core.AppMethodBeat.o(r10);
        r0 = r1;
        goto L_0x001e;
    L_0x008d:
        r0 = move-exception;
        r2 = "Ni.ByteBufferUtil";
        r3 = "hy: exception in finally!";
        r4 = new java.lang.Object[r6];
        com.tencent.magicbrush.a.c.c.a(r2, r0, r3, r4);
        goto L_0x0088;
    L_0x009a:
        r1 = move-exception;
        r0 = r2;
    L_0x009c:
        r2 = "Ni.ByteBufferUtil";
        r3 = "hy: allocateByteBufferFromStream BufferOverflowException";
        r4 = 0;
        r4 = new java.lang.Object[r4];	 Catch:{ all -> 0x00b9 }
        com.tencent.magicbrush.a.c.c.a(r2, r1, r3, r4);	 Catch:{ all -> 0x00b9 }
        r11.reset();	 Catch:{ Exception -> 0x00ac }
        goto L_0x0067;
    L_0x00ac:
        r1 = move-exception;
        r2 = "Ni.ByteBufferUtil";
        r3 = "hy: exception in finally!";
        r4 = new java.lang.Object[r6];
        com.tencent.magicbrush.a.c.c.a(r2, r1, r3, r4);
        goto L_0x0067;
    L_0x00b9:
        r0 = move-exception;
        r11.reset();	 Catch:{ Exception -> 0x00c1 }
    L_0x00bd:
        com.tencent.matrix.trace.core.AppMethodBeat.o(r10);
        throw r0;
    L_0x00c1:
        r1 = move-exception;
        r2 = "Ni.ByteBufferUtil";
        r3 = "hy: exception in finally!";
        r4 = new java.lang.Object[r6];
        com.tencent.magicbrush.a.c.c.a(r2, r1, r3, r4);
        goto L_0x00bd;
    L_0x00ce:
        r1 = move-exception;
        goto L_0x009c;
    L_0x00d0:
        r0 = r2;
        goto L_0x0054;
        */
        throw new UnsupportedOperationException("Method not decompiled: com.github.henryye.nativeiv.b.a.f(java.io.InputStream):java.nio.ByteBuffer");
    }
}
