package androidx.emoji2.text; import java.io.IOException; import java.nio.ByteBuffer; import java.nio.ByteOrder; import p041n0.C1495b; /* renamed from: androidx.emoji2.text.o */ /* loaded from: classes.dex */ public class C0251o { /* renamed from: androidx.emoji2.text.o$a */ /* loaded from: classes.dex */ public static class C0252a implements InterfaceC0254c { /* renamed from: a */ public final ByteBuffer f1135a; public C0252a(ByteBuffer byteBuffer) { this.f1135a = byteBuffer; byteBuffer.order(ByteOrder.BIG_ENDIAN); } @Override // androidx.emoji2.text.C0251o.InterfaceC0254c /* renamed from: a */ public long mo4325a() { return C0251o.m4328c(this.f1135a.getInt()); } @Override // androidx.emoji2.text.C0251o.InterfaceC0254c /* renamed from: b */ public void mo4324b(int i) { ByteBuffer byteBuffer = this.f1135a; byteBuffer.position(byteBuffer.position() + i); } @Override // androidx.emoji2.text.C0251o.InterfaceC0254c /* renamed from: c */ public int mo4323c() { return this.f1135a.getInt(); } @Override // androidx.emoji2.text.C0251o.InterfaceC0254c public long getPosition() { return this.f1135a.position(); } @Override // androidx.emoji2.text.C0251o.InterfaceC0254c public int readUnsignedShort() { return C0251o.m4327d(this.f1135a.getShort()); } } /* renamed from: androidx.emoji2.text.o$b */ /* loaded from: classes.dex */ public static class C0253b { /* renamed from: a */ public final long f1136a; /* renamed from: b */ public final long f1137b; public C0253b(long j, long j2) { this.f1136a = j; this.f1137b = j2; } /* renamed from: a */ public long m4326a() { return this.f1136a; } } /* renamed from: androidx.emoji2.text.o$c */ /* loaded from: classes.dex */ public interface InterfaceC0254c { /* renamed from: a */ long mo4325a(); /* renamed from: b */ void mo4324b(int i); /* renamed from: c */ int mo4323c(); long getPosition(); int readUnsignedShort(); } /* renamed from: a */ public static C0253b m4330a(InterfaceC0254c interfaceC0254c) { long j; interfaceC0254c.mo4324b(4); int readUnsignedShort = interfaceC0254c.readUnsignedShort(); if (readUnsignedShort <= 100) { interfaceC0254c.mo4324b(6); int i = 0; while (true) { if (i >= readUnsignedShort) { j = -1; break; } int mo4323c = interfaceC0254c.mo4323c(); interfaceC0254c.mo4324b(4); j = interfaceC0254c.mo4325a(); interfaceC0254c.mo4324b(4); if (1835365473 == mo4323c) { break; } i++; } if (j != -1) { interfaceC0254c.mo4324b((int) (j - interfaceC0254c.getPosition())); interfaceC0254c.mo4324b(12); long mo4325a = interfaceC0254c.mo4325a(); for (int i2 = 0; i2 < mo4325a; i2++) { int mo4323c2 = interfaceC0254c.mo4323c(); long mo4325a2 = interfaceC0254c.mo4325a(); long mo4325a3 = interfaceC0254c.mo4325a(); if (1164798569 == mo4323c2 || 1701669481 == mo4323c2) { return new C0253b(mo4325a2 + j, mo4325a3); } } } throw new IOException("Cannot read metadata."); } throw new IOException("Cannot read metadata."); } /* renamed from: b */ public static C1495b m4329b(ByteBuffer byteBuffer) { ByteBuffer duplicate = byteBuffer.duplicate(); duplicate.position((int) m4330a(new C0252a(duplicate)).m4326a()); return C1495b.m1160h(duplicate); } /* renamed from: c */ public static long m4328c(int i) { return i & 4294967295L; } /* renamed from: d */ public static int m4327d(short s) { return s & 65535; } }