//
// png_icc_check_tag_table from 0xbc6eec to 0xbc7064 (376 bytes)
//
// 3 xrefs:
// > png_colorspace_set_ICC @ 0xbca370
// > png_handle_iCCP @ 0xbdffdc
// > ??> @ 0x50988
//
// 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
//
__int64 __fastcall png_icc_check_tag_table(__int64 a1, __int64 a2, __int64 a3, unsigned int a4, unsigned __int8 *a5)
{
unsigned __int8 *v5; // x19
int v6; // w20
unsigned __int8 *v11; // x26
unsigned int v12; // w0
int v13; // w1
unsigned int v14; // w20
unsigned int v15; // w28
unsigned int v16; // w27
v5 = a5 + 132;
v6 = (a5[129] << 16) + (a5[128] << 24) + a5[131] + (a5[130] << 8);
if ( v6 )
{
v11 = &a5[12 * (v6 - 1) + 144];
do
{
v13 = v5[4];
v5 += 12;
v14 = (*(v5 - 7) << 16) + (v13 << 24) + *(v5 - 5) + (*(v5 - 6) << 8);
v15 = (*(v5 - 11) << 16) + (*(v5 - 12) << 24) + *(v5 - 9) + (*(v5 - 10) << 8);
v16 = (*(v5 - 3) << 16) + (*(v5 - 4) << 24) + *(v5 - 1) + (*(v5 - 2) << 8);
if ( (*(v5 - 5) & 3) != 0 )
{
sub_BC5278(a1, 0, a3, v15, (__int64)&unk_F2C9F8);
v12 = a4 - v14;
if ( v14 > a4 )
return sub_BC5278(a1, a2, a3, v15, (__int64)"ICC profile tag outside profile");
}
else
{
v12 = a4 - v14;
if ( v14 > a4 )
return sub_BC5278(a1, a2, a3, v15, (__int64)"ICC profile tag outside profile");
}
if ( v16 > v12 )
return sub_BC5278(a1, a2, a3, v15, (__int64)"ICC profile tag outside profile");
}
while ( v5 != v11 );
}
return 1;
}