package g.i.a.c.z;

import java.util.Iterator;
import java.util.List;
import java.util.Locale;

/* JADX INFO: loaded from: classes.dex */
public class f extends g.i.a.c.o.a {
    public static int m(g.i.a.c.l.e.a aVar, g.i.a.c.q.i iVar) {
        if (iVar == null) {
            return 1;
        }
        int i2 = aVar.f5575z;
        int i3 = aVar.f5573x;
        g.i.a.c.l.a aVar2 = null;
        int i4 = iVar.f5674j;
        if (i4 == 4 || i4 == 6 || i4 == 7 || i4 == 8 || i4 == 10) {
            Iterator<g.i.a.c.l.a> it = g.i.a.c.l.a.f5506c.iterator();
            while (true) {
                if (!it.hasNext()) {
                    break;
                }
                g.i.a.c.l.a next = it.next();
                if (next.f5511h == i2) {
                    if (next.f5512i) {
                        aVar2 = next;
                    }
                }
            }
            if (aVar2 != null) {
                g.h.a.i.w0(aVar2.toString());
                List<g.i.a.c.q.h> list = iVar.Q;
                if (list != null && list.size() > 0) {
                    Iterator<g.i.a.c.q.h> it2 = list.iterator();
                    while (true) {
                        if (!it2.hasNext()) {
                            break;
                        }
                        g.i.a.c.q.h next2 = it2.next();
                        if (next2.f5725f == aVar2.f5508e) {
                            int i5 = next2.f5729p;
                            if (i5 > 0 && i3 > i5) {
                                g.h.a.i.W3(String.format(Locale.US, "image size is %d exceed the limit of the section size %d", Integer.valueOf(i3), Integer.valueOf(next2.f5729p)));
                                return 2;
                            }
                            g.a.a.a.a.b0("section size validate ok: ", i3);
                        }
                    }
                }
            }
        } else {
            StringBuilder sbF = g.a.a.a.a.F("not support section size check for ic:");
            sbF.append(iVar.f5674j);
            g.h.a.i.V3(true, sbF.toString());
        }
        return 1;
    }

    /* JADX WARN: Removed duplicated region for block: B:62:0x01fa  */
    /* JADX WARN: Removed duplicated region for block: B:64:0x01fd  */
    /* JADX WARN: Removed duplicated region for block: B:76:0x026a  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public static g.i.a.c.q.a n(g.i.a.c.l.c r32) throws g.i.a.c.g.b {
        /*
            Method dump skipped, instruction units count: 907
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: g.i.a.c.z.f.n(g.i.a.c.l.c):g.i.a.c.q.a");
    }

    public static boolean o(int i2) {
        return i2 == 5 || i2 == 21 || i2 == 4 || i2 == 20 || i2 == 2 || i2 == 18 || i2 == 7 || i2 == 23 || i2 == 6 || i2 == 22;
    }

    public static int p(int i2, g.i.a.c.l.e.a aVar, g.i.a.c.q.i iVar) {
        if (iVar == null) {
            return 1;
        }
        int i3 = aVar.f5573x;
        int i4 = iVar.f5674j;
        if (i4 == 4 || i4 == 6 || i4 == 7 || i4 == 8 || i4 == 10) {
            List<g.i.a.c.q.h> list = iVar.Q;
            if (list != null && list.size() > 0) {
                Iterator<g.i.a.c.q.h> it = list.iterator();
                while (true) {
                    if (!it.hasNext()) {
                        break;
                    }
                    g.i.a.c.q.h next = it.next();
                    if (next.f5725f == i2) {
                        int i5 = next.f5729p;
                        if (i5 > 0 && i3 > i5) {
                            g.h.a.i.W3(String.format(Locale.US, "image size is %d exceed the limit of the section size %d", Integer.valueOf(i3), Integer.valueOf(next.f5729p)));
                            return 2;
                        }
                        g.a.a.a.a.b0("section size validate ok: ", i3);
                    }
                }
            }
        } else {
            StringBuilder sbF = g.a.a.a.a.F("not support section size check for ic:");
            sbF.append(iVar.f5674j);
            g.h.a.i.V3(true, sbF.toString());
        }
        return 1;
    }

    /* JADX WARN: Removed duplicated region for block: B:42:0x019c  */
    /* JADX WARN: Removed duplicated region for block: B:46:0x01f6  */
    /* JADX WARN: Removed duplicated region for block: B:50:0x0204  */
    /* JADX WARN: Removed duplicated region for block: B:57:0x0211  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public static g.i.a.c.q.a q(g.i.a.c.l.c r32) throws g.i.a.c.g.b {
        /*
            Method dump skipped, instruction units count: 666
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: g.i.a.c.z.f.q(g.i.a.c.l.c):g.i.a.c.q.a");
    }

    /* JADX WARN: Code restructure failed: missing block: B:75:0x0286, code lost:
    
        if (r0 < 0) goto L79;
     */
    /* JADX WARN: Removed duplicated region for block: B:58:0x01f8  */
    /* JADX WARN: Removed duplicated region for block: B:62:0x024b  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public static g.i.a.c.q.a r(g.i.a.c.l.c r30) throws g.i.a.c.g.b {
        /*
            Method dump skipped, instruction units count: 760
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: g.i.a.c.z.f.r(g.i.a.c.l.c):g.i.a.c.q.a");
    }
}
