package com.google.gson.internal;

import com.bytedance.covode.number.Covode;
import com.google.gson.c.c;
import com.google.gson.internal.bind.TypeAdapters;
import com.google.gson.j;
import java.io.Writer;

public final class k {
    static {
        Covode.recordClassIndex(45502);
    }

    public static Writer LIZ(Appendable appendable) {
        if (appendable instanceof Writer) {
            return (Writer) appendable;
        }
        return new a(appendable);
    }

    /* JADX WARNING: type inference failed for: r0v0, types: [java.lang.Throwable, com.google.gson.s] */
    /* JADX WARNING: type inference failed for: r0v1, types: [java.lang.Throwable, com.google.gson.k] */
    /* JADX WARNING: type inference failed for: r0v2, types: [java.lang.Throwable, com.google.gson.s] */
    /* JADX WARNING: type inference failed for: r0v7, types: [java.lang.Throwable, com.google.gson.s] */
    /* JADX WARNING: Code restructure failed: missing block: B:11:0x0019, code lost:
        throw new com.google.gson.s((java.lang.Throwable) r1);
     */
    /* JADX WARNING: Code restructure failed: missing block: B:12:0x001a, code lost:
        r1 = move-exception;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:14:0x0020, code lost:
        throw new com.google.gson.k((java.lang.Throwable) r1);
     */
    /* JADX WARNING: Code restructure failed: missing block: B:15:0x0021, code lost:
        r1 = move-exception;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:17:0x0027, code lost:
        throw new com.google.gson.s((java.lang.Throwable) r1);
     */
    /* JADX WARNING: Code restructure failed: missing block: B:4:0x0008, code lost:
        return com.google.gson.l.LIZ;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:9:0x0013, code lost:
        r1 = move-exception;
     */
    /* JADX WARNING: Failed to process nested try/catch */
    /* JADX WARNING: Removed duplicated region for block: B:12:0x001a A[ExcHandler: IOException (r1v2 'e' java.io.IOException A[CUSTOM_DECLARE]), Splitter:B:0:0x0000] */
    /* JADX WARNING: Removed duplicated region for block: B:15:0x0021 A[ExcHandler: d (r1v1 'e' com.google.gson.c.d A[CUSTOM_DECLARE]), Splitter:B:0:0x0000] */
    /* JADX WARNING: Removed duplicated region for block: B:9:0x0013 A[ExcHandler: NumberFormatException (r1v3 'e' java.lang.NumberFormatException A[CUSTOM_DECLARE]), Splitter:B:0:0x0000] */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    public static com.google.gson.j LIZ(com.google.gson.c.a r1) {
        /*
            r1.LJFF()     // Catch:{ EOFException -> 0x0004, d -> 0x0021, IOException -> 0x001a, NumberFormatException -> 0x0013 }
            goto L_0x0009
        L_0x0004:
            r0 = move-exception
            r0 = 1
            com.google.gson.l r0 = com.google.gson.l.LIZ
            return r0
        L_0x0009:
            r0 = 0
            com.google.gson.u<com.google.gson.j> r0 = com.google.gson.internal.bind.TypeAdapters.LJJJJLI     // Catch:{ EOFException -> 0x0028, d -> 0x0021, IOException -> 0x001a, NumberFormatException -> 0x0013 }
            java.lang.Object r0 = r0.read(r1)     // Catch:{ EOFException -> 0x0028, d -> 0x0021, IOException -> 0x001a, NumberFormatException -> 0x0013 }
            com.google.gson.j r0 = (com.google.gson.j) r0     // Catch:{ EOFException -> 0x0028, d -> 0x0021, IOException -> 0x001a, NumberFormatException -> 0x0013 }
            return r0
        L_0x0013:
            r1 = move-exception
            com.google.gson.s r0 = new com.google.gson.s
            r0.<init>((java.lang.Throwable) r1)
            throw r0
        L_0x001a:
            r1 = move-exception
            com.google.gson.k r0 = new com.google.gson.k
            r0.<init>((java.lang.Throwable) r1)
            throw r0
        L_0x0021:
            r1 = move-exception
            com.google.gson.s r0 = new com.google.gson.s
            r0.<init>((java.lang.Throwable) r1)
            throw r0
        L_0x0028:
            r1 = move-exception
            com.google.gson.s r0 = new com.google.gson.s
            r0.<init>((java.lang.Throwable) r1)
            throw r0
        */
        throw new UnsupportedOperationException("Method not decompiled: com.google.gson.internal.k.LIZ(com.google.gson.c.a):com.google.gson.j");
    }

    public static void LIZ(j jVar, c cVar) {
        TypeAdapters.LJJJJLI.write(cVar, jVar);
    }
}
