//
// png_icc_check_tag_table from 0x64e00c to 0x64e0ee (226 bytes)
//
// 2 xrefs:
// > png_colorspace_set_ICC @ 0x65039a
// > png_handle_iCCP @ 0x65d2fc
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
int __fastcall png_icc_check_tag_table(int a1, int a2, int a3, unsigned int a4, unsigned __int8 *a5)
{
int v5; // r10
unsigned __int8 *v8; // r7
int v9; // r8
unsigned int v10; // r3
int v11; // r1
int v12; // r4
unsigned int v13; // r4
unsigned int v14; // r5
unsigned int v15; // r6
v5 = (a5[129] << 16) + (a5[128] << 24) + a5[131] + (a5[130] << 8);
if ( v5 )
{
v8 = a5 + 144;
v9 = 0;
do
{
v11 = *(v8 - 7);
++v9;
v12 = *(v8 - 8);
v8 += 12;
v13 = (v11 << 16) + (v12 << 24) + *(v8 - 17) + (*(v8 - 18) << 8);
v14 = (*(v8 - 15) << 16) + (*(v8 - 16) << 24) + *(v8 - 13) + (*(v8 - 14) << 8);
v15 = *(v8 - 21) + (*(v8 - 23) << 16) + (*(v8 - 24) << 24) + (*(v8 - 22) << 8);
if ( v13 << 30 )
{
sub_64D088(a1, 0, a3, v15, (int)"ICC profile tag start not a multiple of 4");
v10 = a4 - v13;
if ( v13 > a4 )
return sub_64D088(a1, a2, a3, v15, (int)"ICC profile tag outside profile");
}
else
{
v10 = a4 - v13;
if ( v13 > a4 )
return sub_64D088(a1, a2, a3, v15, (int)"ICC profile tag outside profile");
}
if ( v14 > v10 )
return sub_64D088(a1, a2, a3, v15, (int)"ICC profile tag outside profile");
}
while ( v9 != v5 );
}
return 1;
}