package g.i.a.c.z;

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

/* JADX INFO: loaded from: classes.dex */
public class g extends g.i.a.c.o.a {

    public static class a implements Comparator<g.i.a.c.l.e.a> {
        @Override // java.util.Comparator
        public int compare(g.i.a.c.l.e.a aVar, g.i.a.c.l.e.a aVar2) {
            return aVar.M - aVar2.M;
        }
    }

    public static class b implements Comparator<g.i.a.c.l.e.a> {
        @Override // java.util.Comparator
        public int compare(g.i.a.c.l.e.a aVar, g.i.a.c.l.e.a aVar2) {
            return aVar.M - aVar2.M;
        }
    }

    public static int m(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;
        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 i4 = next.f5729p;
                    if (i4 > 0 && i3 > i4) {
                        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 validate ok: ", i3);
                }
            }
        }
        return 1;
    }

    public static int n(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;
        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 i4 = next2.f5729p;
                        if (i4 > 0 && i3 > i4) {
                            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 validate ok: ", i3);
                    }
                }
            }
        }
        return 1;
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Removed duplicated region for block: B:56:0x0249  */
    /* JADX WARN: Removed duplicated region for block: B:63:0x0256  */
    /* JADX WARN: Type inference failed for: r1v15 */
    /* JADX WARN: Type inference failed for: r1v16 */
    /* JADX WARN: Type inference failed for: r1v7 */
    /*
        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 o(g.i.a.c.l.c r30) throws g.i.a.c.g.b {
        /*
            Method dump skipped, instruction units count: 753
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: g.i.a.c.z.g.o(g.i.a.c.l.c):g.i.a.c.q.a");
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Removed duplicated region for block: B:46:0x0216  */
    /* JADX WARN: Removed duplicated region for block: B:53:0x0223  */
    /* JADX WARN: Type inference failed for: r0v35 */
    /* JADX WARN: Type inference failed for: r0v50 */
    /* JADX WARN: Type inference failed for: r0v51 */
    /*
        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 p(g.i.a.c.l.c r30) throws g.i.a.c.g.b {
        /*
            Method dump skipped, instruction units count: 781
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: g.i.a.c.z.g.p(g.i.a.c.l.c):g.i.a.c.q.a");
    }

    /* JADX WARN: Code restructure failed: missing block: B:100:0x0303, code lost:
    
        r3 = r0;
     */
    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Removed duplicated region for block: B:49:0x0211  */
    /* JADX WARN: Removed duplicated region for block: B:56:0x021e  */
    /* JADX WARN: Type inference failed for: r14v4 */
    /* JADX WARN: Type inference failed for: r14v5 */
    /* JADX WARN: Type inference failed for: r14v9 */
    /* JADX WARN: Type inference failed for: r22v0 */
    /* JADX WARN: Type inference failed for: r22v1 */
    /* JADX WARN: Type inference failed for: r4v15 */
    /* JADX WARN: Type inference failed for: r4v16 */
    /* JADX WARN: Type inference failed for: r4v7 */
    /* JADX WARN: Type inference failed for: r4v8, types: [boolean, int] */
    /*
        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 r30) throws g.i.a.c.g.b {
        /*
            Method dump skipped, instruction units count: 795
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: g.i.a.c.z.g.q(g.i.a.c.l.c):g.i.a.c.q.a");
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Removed duplicated region for block: B:50:0x0239  */
    /* JADX WARN: Removed duplicated region for block: B:57:0x0246  */
    /* JADX WARN: Type inference failed for: r1v17 */
    /* JADX WARN: Type inference failed for: r1v32 */
    /* JADX WARN: Type inference failed for: r1v33 */
    /*
        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 r31) throws g.i.a.c.g.b {
        /*
            Method dump skipped, instruction units count: 747
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: g.i.a.c.z.g.r(g.i.a.c.l.c):g.i.a.c.q.a");
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Removed duplicated region for block: B:61:0x025b  */
    /* JADX WARN: Removed duplicated region for block: B:68:0x0268  */
    /* JADX WARN: Type inference failed for: r15v3 */
    /* JADX WARN: Type inference failed for: r15v6 */
    /* JADX WARN: Type inference failed for: r15v7 */
    /*
        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 s(g.i.a.c.l.c r29) throws g.i.a.c.g.b {
        /*
            Method dump skipped, instruction units count: 796
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: g.i.a.c.z.g.s(g.i.a.c.l.c):g.i.a.c.q.a");
    }

    /* JADX WARN: Removed duplicated region for block: B:49:0x01a6  */
    /* JADX WARN: Removed duplicated region for block: B:59:0x0212  */
    /*
        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 t(g.i.a.c.l.c r28) throws g.i.a.c.g.b {
        /*
            Method dump skipped, instruction units count: 790
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: g.i.a.c.z.g.t(g.i.a.c.l.c):g.i.a.c.q.a");
    }
}
